Esempio n. 1
0
        public static ProfileData ReadFrom(BinaryReader reader)
        {
            var version = reader.ReadInt32();

            Debug.Assert(version == currentVersion);

            var frameIndexOffset = reader.ReadInt32();
            var data             = new ProfileData(frameIndexOffset);

            int numFrames = reader.ReadInt32();

            for (int i = 0; i < numFrames; i++)
            {
                var frame = ProfileFrame.ReadFrom(reader);
                data.frames.Add(frame);
            }

            int numMarkers = reader.ReadInt32();

            for (int i = 0; i < numMarkers; i++)
            {
                var markerName = reader.ReadString();
                data.markerNames.Add(markerName);
            }

            int numThreads = reader.ReadInt32();

            for (int i = 0; i < numThreads; i++)
            {
                var threadName = reader.ReadString();
                data.threadNames.Add(threadName);
            }

            return(data);
        }
Esempio n. 2
0
        public static ProfileFrame ReadFrom(BinaryReader reader)
        {
            var startTimeMS = reader.ReadDouble();
            var frameMS     = reader.ReadSingle();
            var frame       = new ProfileFrame(startTimeMS, frameMS);

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var thread = ProfileThread.ReadFrom(reader);
                frame.threads.Add(thread);
            }

            return(frame);
        }
Esempio n. 3
0
        public Exporter(IEnumerable <Frame> frames, long frequency)
        {
            data.AddThreadName("1:Main Thread");

            foreach (var frame in frames)
            {
                var startTimeMS  = frame.CalcStartTime(frequency);
                var frameMS      = frame.CalcElapsedMilliseconds(frequency);
                var profileFrame = new ProfileFrame(startTimeMS, frameMS);
                data.Add(profileFrame);

                var thread = new ProfileThread(0);
                profileFrame.Add(thread);

                foreach (var child in frame.Root.Children)
                {
                    AddMarkers(thread, child, 1, frequency);
                }
            }
        }
Esempio n. 4
0
 public void Add(ProfileFrame frame)
 {
     frames.Add(frame);
 }