示例#1
0
        public static EventDescriptionBoard Read(DataResponse response)
        {
            BinaryReader reader = response.Reader;

            EventDescriptionBoard desc = new EventDescriptionBoard()
            {
                Response = response
            };

            desc.BaseStream = reader.BaseStream;
            desc.ID         = reader.ReadInt32();

            desc.Frequency = reader.ReadInt64();
            Durable.InitFrequency(desc.Frequency);

            desc.TimeSlice = new Durable();
            desc.TimeSlice.ReadDurable(reader);

            int threadCount = reader.ReadInt32();

            desc.Threads = new List <ThreadDescription>(threadCount);
            desc.ThreadID2ThreadIndex = new Dictionary <UInt64, int>();

            for (int i = 0; i < threadCount; ++i)
            {
                ThreadDescription threadDesc = ThreadDescription.Read(response);
                desc.Threads.Add(threadDesc);

                if (!desc.ThreadID2ThreadIndex.ContainsKey(threadDesc.ThreadID))
                {
                    desc.ThreadID2ThreadIndex.Add(threadDesc.ThreadID, i);
                }
                else
                {
                    // The old thread was finished and the new thread was started
                    // with the same threadID during one profiling session.
                    // Can't do much here - lets show information for the new thread only.
                    desc.ThreadID2ThreadIndex[threadDesc.ThreadID] = i;
                }
            }

            int fibersCount = reader.ReadInt32();

            desc.Fibers = new List <FiberDescription>(fibersCount);
            for (int i = 0; i < fibersCount; ++i)
            {
                FiberDescription fiberDesc = FiberDescription.Read(response);
                desc.Fibers.Add(fiberDesc);
            }

            desc.MainThreadIndex = reader.ReadInt32();

            int count = reader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                desc.board.Add(EventDescription.Read(reader, i));
            }
            return(desc);
        }
示例#2
0
        public void Add(DataResponse.Type dataType, BinaryReader reader)
        {
            switch (dataType)
            {
            case DataResponse.Type.FrameDescriptionBoard:
            {
                EventDescriptionBoard board = EventDescriptionBoard.Read(reader);
                groups[board.ID] = new FrameGroup(board);
                break;
            }

            case DataResponse.Type.EventFrame:
            {
                int        id    = reader.ReadInt32();
                FrameGroup group = groups[id];
                EventFrame frame = new EventFrame(reader, group);

                group.Add(frame);

                if (group.Board.MainThreadIndex == frame.Header.ThreadIndex)
                {
                    Add(frame);
                }

                break;
            }

            case DataResponse.Type.SamplingFrame:
            {
                Add(new SamplingFrame(reader));
                break;
            }
            }
        }
示例#3
0
文件: Tag.cs 项目: thekoder/brofiler
 public override void Read(BinaryReader reader, EventDescriptionBoard board)
 {
     base.Read(reader, board);
     Value = new Vec3 {
         X = reader.ReadSingle(), Y = reader.ReadSingle(), Z = reader.ReadSingle()
     };
 }
示例#4
0
        public static FramePack Create(DataResponse response, EventDescriptionBoard board)
        {
            FramePack pack = new FramePack();

            pack.Response = response;

            int frameCount = response.Reader.ReadInt32();

            for (int frame = 0; frame < frameCount; ++frame)
            {
                FrameList list = new FrameList();
                list.FrameType = (FrameList.Type)frame;
                int count = response.Reader.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    FrameData frameData = FrameData.Read(response, board);
                    if (frameData.IsNonZero)
                    {
                        list.Events.Add(frameData);
                    }
                }
                pack.Threads.Add(list);
            }
            return(pack);
        }
示例#5
0
        protected void ReadEntry(BinaryReader reader, EventDescriptionBoard board)
        {
            ReadEventData(reader);
            int index = reader.ReadInt32();

            Description = (index != -1 && index < board.Board.Count) ? board[index] : null;
        }
示例#6
0
        public static Entry Read(BinaryReader reader, EventDescriptionBoard board)
        {
            Entry res = new Entry();

            res.ReadEntry(reader, board);
            return(res);
        }
 protected void ReadEntry(BinaryReader reader, EventDescriptionBoard board)
 {
     ReadEventData(reader);
     DescriptionId = reader.ReadInt32();
     Description   = DescriptionId != -1 ? board[DescriptionId] : null;
     Id            = reader.ReadUInt32();
 }
示例#8
0
        public static EventDescriptionBoard Read(BinaryReader reader)
        {
            EventDescriptionBoard desc = new EventDescriptionBoard();

            desc.BaseStream = reader.BaseStream;
            desc.ID         = reader.ReadInt32();

            desc.Frequency = reader.ReadInt64();
            Durable.InitFrequency(desc.Frequency);

            desc.TimeSlice = new Durable();
            desc.TimeSlice.ReadDurable(reader);

            int threadCount = reader.ReadInt32();

            desc.Threads = new List <ThreadDescription>(threadCount);

            for (int i = 0; i < threadCount; ++i)
            {
                desc.Threads.Add(ThreadDescription.Read(reader));
            }

            desc.MainThreadIndex = reader.ReadInt32();

            int count = reader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                desc.board.Add(EventDescription.Read(reader, i));
            }
            return(desc);
        }
示例#9
0
文件: Tag.cs 项目: thekoder/brofiler
        public virtual void Read(BinaryReader reader, EventDescriptionBoard board)
        {
            Time = new Tick {
                Start = Durable.ReadTime(reader)
            };
            int descriptionID = reader.ReadInt32();

            Description = (0 <= descriptionID && descriptionID < board.Board.Count) ? board.Board[descriptionID] : null;
        }
示例#10
0
 public FTraceGroup()
 {
     Board = new EventDescriptionBoard()
     {
         TimeSettings = new TimeSettings()
         {
             Origin = 0, PrecisionCut = 0, TicksToMs = 0.001
         }
     };
     Group = new FrameGroup(Board);
 }
示例#11
0
        public static Entry Read(BinaryReader reader, EventDescriptionBoard board)
        {
            Entry res = new Entry();

            res.ReadEventData(reader);

            int descriptionID = reader.ReadInt32();

            res.Description = board[descriptionID];

            return(res);
        }
示例#12
0
        static List <Entry> ReadEventList(BinaryReader reader, EventDescriptionBoard board)
        {
            int          count  = reader.ReadInt32();
            List <Entry> result = new List <Entry>(count);

            for (int i = 0; i < count; ++i)
            {
                result.Add(Entry.Read(reader, board));
            }

            return(result);
        }
示例#13
0
        public List <Entry> ReadEventList(BinaryReader reader, EventDescriptionBoard board)
        {
            int          count  = reader.ReadInt32();
            List <Entry> result = new List <Entry>(count);

            for (int i = 0; i < count; ++i)
            {
                Entry entry = Entry.Read(reader, board);
                entry.Frame = this;
                result.Add(entry);
            }

            return(result);
        }
示例#14
0
        public static FrameData Read(DataResponse response, EventDescriptionBoard board)
        {
            FrameData res = new FrameData();

            res.ReadEntry(response.Reader, board);

            if (response.Version >= NetworkProtocol.NETWORK_PROTOCOL_VERSION_25)
            {
                res.ThreadID = response.Reader.ReadUInt64();
            }
            else
            {
                res.ThreadID = UInt64.MaxValue;
            }

            return(res);
        }
示例#15
0
        public static EventDescriptionBoard Read(DataResponse response)
        {
            BinaryReader reader = response.Reader;

            EventDescriptionBoard desc = new EventDescriptionBoard();

            desc.Response   = response;
            desc.BaseStream = reader.BaseStream;
            desc.ID         = reader.ReadInt32();

            desc.TimeSettings              = new TimeSettings();
            desc.TimeSettings.TicksToMs    = 1000.0 / (double)reader.ReadInt64();
            desc.TimeSettings.Origin       = reader.ReadInt64();
            desc.TimeSettings.PrecisionCut = reader.ReadInt32();
            Durable.InitSettings(desc.TimeSettings);

            desc.TimeSlice = new Durable();
            desc.TimeSlice.ReadDurable(reader);

            int threadCount = reader.ReadInt32();

            desc.Threads = new List <ThreadDescription>(threadCount);
            desc.ThreadID2ThreadIndex = new Dictionary <UInt64, int>();

            for (int i = 0; i < threadCount; ++i)
            {
                ThreadDescription threadDesc = ThreadDescription.Read(response);
                threadDesc.Origin      = ThreadDescription.Source.Game;
                threadDesc.ThreadIndex = i;
                desc.Threads.Add(threadDesc);

                if (!desc.ThreadID2ThreadIndex.ContainsKey(threadDesc.ThreadID))
                {
                    desc.ThreadID2ThreadIndex.Add(threadDesc.ThreadID, i);
                    desc.ThreadDescriptions.Add(threadDesc.ThreadID, threadDesc);
                }
                else
                {
                    // The old thread was finished and the new thread was started
                    // with the same threadID during one profiling session.
                    // Can't do much here - lets show information for the new thread only.
                    desc.ThreadID2ThreadIndex[threadDesc.ThreadID] = i;
                }
            }

            if (response.ApplicationID == NetworkProtocol.OPTICK_APP_ID)
            {
                int fibersCount = reader.ReadInt32();
                desc.Fibers = new List <FiberDescription>(fibersCount);
                for (int i = 0; i < fibersCount; ++i)
                {
                    FiberDescription fiberDesc = FiberDescription.Read(response);
                    desc.Fibers.Add(fiberDesc);
                }
            }

            desc.MainThreadIndex = reader.ReadInt32();

            int count = reader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                desc.board.Add(EventDescription.Read(reader, i));
            }

            // TODO: Tags
            reader.ReadUInt32();

            // TODO: Run Info
            reader.ReadUInt32();

            // TODO: Run Info
            reader.ReadUInt32();

            // TODO: Filters
            reader.ReadUInt32();

            // TODO: Mode
            desc.Mode = reader.ReadUInt32();

            // TODO: Thread Descriptions
            int processDescCount = reader.ReadInt32();

            for (int i = 0; i < processDescCount; ++i)
            {
                ProcessDescription process = ProcessDescription.Read(response);
                if (!desc.ProcessDescritpions.ContainsKey(process.ProcessID))
                {
                    desc.ProcessDescritpions.Add(process.ProcessID, process);
                }
            }

            int threadDescCount = reader.ReadInt32();

            for (int i = 0; i < threadDescCount; ++i)
            {
                ThreadDescription thread = ThreadDescription.Read(response);
                thread.Origin = ThreadDescription.Source.GameAuto;
                if (!desc.ThreadDescriptions.ContainsKey(thread.ThreadID))
                {
                    desc.ThreadDescriptions.Add(thread.ThreadID, thread);
                }
                //else if (!String.IsNullOrEmpty(thread.Name))
                //	desc.ThreadDescriptions[thread.ThreadID] = thread;

                ProcessDescription process = null;
                if (desc.ProcessDescritpions.TryGetValue(thread.ProcessID, out process))
                {
                    thread.Process = process;
                }
            }

            desc.ProcessID    = response.Reader.ReadInt32();
            desc.CPUCoreCount = response.Reader.ReadInt32();

            return(desc);
        }
示例#16
0
 public FrameGroup(EventDescriptionBoard board)
 {
     Board   = board;
     Threads = new List <ThreadData>();
 }
示例#17
0
        public static EventDescriptionBoard Read(DataResponse response)
        {
            BinaryReader reader = response.Reader;

            EventDescriptionBoard desc = new EventDescriptionBoard();

            desc.Response   = response;
            desc.BaseStream = reader.BaseStream;
            desc.ID         = reader.ReadInt32();

            desc.TimeSettings              = new TimeSettings();
            desc.TimeSettings.TicksToMs    = 1000.0 / (double)reader.ReadInt64();
            desc.TimeSettings.Origin       = reader.ReadInt64();
            desc.TimeSettings.PrecisionCut = reader.ReadInt32();
            Durable.InitSettings(desc.TimeSettings);

            desc.TimeSlice = new Durable();
            desc.TimeSlice.ReadDurable(reader);

            int threadCount = reader.ReadInt32();

            desc.Threads = new List <ThreadDescription>(threadCount);
            desc.ThreadID2ThreadIndex = new Dictionary <UInt64, int>();

            for (int i = 0; i < threadCount; ++i)
            {
                ThreadDescription threadDesc = ThreadDescription.Read(response);
                desc.Threads.Add(threadDesc);

                if (!desc.ThreadID2ThreadIndex.ContainsKey(threadDesc.ThreadID))
                {
                    desc.ThreadID2ThreadIndex.Add(threadDesc.ThreadID, i);
                }
                else
                {
                    // The old thread was finished and the new thread was started
                    // with the same threadID during one profiling session.
                    // Can't do much here - lets show information for the new thread only.
                    desc.ThreadID2ThreadIndex[threadDesc.ThreadID] = i;
                }
            }

            if (response.ApplicationID == NetworkProtocol.BROFILER_APP_ID)
            {
                int fibersCount = reader.ReadInt32();
                desc.Fibers = new List <FiberDescription>(fibersCount);
                for (int i = 0; i < fibersCount; ++i)
                {
                    FiberDescription fiberDesc = FiberDescription.Read(response);
                    desc.Fibers.Add(fiberDesc);
                }
            }

            desc.MainThreadIndex = reader.ReadInt32();

            int count = reader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                desc.board.Add(EventDescription.Read(reader, i));
            }

            // TODO: Tags

            // TODO: Run Info

            // TODO: Run Info

            // TODO: Filters

            // TODO: Mode

            // TODO: Thread Descriptions

            return(desc);
        }
示例#18
0
文件: Tag.cs 项目: thekoder/brofiler
 public override void Read(BinaryReader reader, EventDescriptionBoard board)
 {
     base.Read(reader, board);
     Value = Utils.ReadBinaryString(reader);
 }
示例#19
0
文件: Tag.cs 项目: thekoder/brofiler
 public override void Read(BinaryReader reader, EventDescriptionBoard board)
 {
     base.Read(reader, board);
     Value = reader.ReadUInt32();
 }
示例#20
0
文件: SysCall.cs 项目: yresk/optick
 public SysCallEntry(BinaryReader reader, EventDescriptionBoard board)
 {
     ReadEntry(reader, board);
     ThreadID  = reader.ReadUInt64();
     SysCallID = reader.ReadUInt64();
 }