コード例 #1
0
        public static BinlogStats Calculate(string binlogFilePath)
        {
            var stats = new BinlogStats();

            var reader = new BinLogReader();

            reader.OnBlobRead          += (kind, bytes) => stats.OnBlobRead(kind, bytes);
            reader.OnStringRead        += (text, lengthBytes) => stats.OnStringRead(text, lengthBytes);
            reader.OnNameValueListRead += (list, recordLengthBytes) => stats.OnNameValueListRead(list, recordLengthBytes);

            var records = reader.ReadRecords(binlogFilePath);

            stats.Process(records);
            return(stats);
        }
コード例 #2
0
            public virtual void Add(Record record, string type = null, BinlogStats stats = null)
            {
                if (type != null)
                {
                    if (!recordsByType.TryGetValue(type, out var bucket))
                    {
                        bucket = Create(type);
                        recordsByType[type] = bucket;
                    }

                    type = stats.GetSubType(type, record.Args);
                    bucket.Add(record, type, stats);
                }
                else
                {
                    list.Add(record);
                }

                Count       += 1;
                TotalLength += record.Length;
                Largest      = Math.Max(Largest, (int)record.Length);
            }