예제 #1
0
        private void DisplayBarrierStatistics()
        {
            LogRecordStats barrierStats          = null;
            LogRecordStats beginTransactionStats = null;

            if (this.recordStats.TryGetValue(LogRecordType.Barrier, out barrierStats) && this.recordStats.TryGetValue(LogRecordType.BeginTransaction, out beginTransactionStats))
            {
                double barrierCount     = Math.Max(barrierStats.Count, 1);
                double transactionCount = beginTransactionStats.Count;

                Console.WriteLine();
                Console.WriteLine("Transactions per Barrier:\t\t{0}", Math.Round(transactionCount / barrierCount, digits: 2));
            }
        }
예제 #2
0
        public void ProcessRecord(LogRecord record)
        {
            LogRecordStats stats = null;

            if (!this.recordStats.TryGetValue(record.RecordType, out stats))
            {
                stats = LogRecordStatsUtil.GetStatsForRecordType(record.RecordType);
                this.recordStats.Add(record.RecordType, stats);
            }

            // Accumulate statistics about the records.
            this.TotalRecordCount++;
            this.TotalRecordBytes += record.RecordSize;

            // Allow the record stats type to process additional information about the record.
            stats.ProcessRecord(record);
        }
예제 #3
0
        private OperationLogRecordStats GetOperationStats(LogRecordType recordType)
        {
            LogRecordStats stats = null;

            if (this.recordStats.TryGetValue(recordType, out stats))
            {
                if (stats is OperationLogRecordStats)
                {
                    return(stats as OperationLogRecordStats);
                }

                throw new ArgumentException("Record type is not an 'operation' log record.", "recordType");
            }

            // Return an empty stats to make the math easier.
            return(new OperationLogRecordStats(recordType));
        }