Пример #1
0
        internal virtual void DeCompress(CompressedDataItem8 item, DateTime baseTime)
        {
            this.ProcessId       = item.Pid;
            this.ThreadId        = item.Tid;
            this.ActivityIdIndex = item.Aid;
            this.FileIndex       = item.FileIndex;
            this.Level           = LevelMapping[item.Level];

            this.Time       = baseTime.AddSeconds(item.TimeOffsetSeconds);
            this.TemplateId = item.TemplateId;
        }
Пример #2
0
        internal virtual bool Compress(DateTime baseTime, out CompressedDataItem8 item)
        {
            item = new CompressedDataItem8();

            if ((this.ProcessId >> CompressedDataItem8.PidSize) > 0)
            {
                return(false);
            }
            item.Pid = this.ProcessId;
            if ((this.ThreadId >> CompressedDataItem8.TidSize) > 0)
            {
                return(false);
            }
            item.Tid = this.ThreadId;
            if ((this.ActivityIdIndex >> CompressedDataItem8.AidSize) > 0)
            {
                return(false);
            }
            item.Aid = this.ActivityIdIndex;
            if ((this.FileIndex >> CompressedDataItem8.FileIndexSize) > 0)
            {
                return(false);
            }
            item.FileIndex = this.FileIndex;
            item.Level     = LevelReverseMapping[(int)this.Level];

            var timeDiff = (int)(this.Time - baseTime).TotalSeconds;

            if ((timeDiff >> CompressedDataItem8.TimeSize) > 0)
            {
                return(false);
            }
            item.TimeOffsetSeconds = timeDiff;

            if ((this.TemplateId >> CompressedDataItem8.TemplateIdSize) > 0)
            {
                return(false);
            }
            item.TemplateId = (ushort)this.TemplateId;

            item.State = CompressState.Compressed8;

            return(true);
        }