Beispiel #1
0
        public List <PerfNodeStats> GetStatsForRange(int start, int end)
        {
            var list = new NodeInfo[ppLookup.Count];

            var nodeInframe = new byte[ppLookup.Count];
            var parent      = new ushort[ppLookup.Count];

            for (int j = start; j < end; j++)
            {
                var frame = Frames[j];
                var calls = frame.Calls;

                for (int i = 1; i < calls.Length; i++)
                {
                    int id            = calls[i].ppid;
                    var exclusiveTime = calls[i].ExclusiveTime;

                    nodeInframe[id] = 1;

                    list[id].NodeCount++;
                    list[id].CallCount          += calls[i].CallCount;
                    list[id].TotalTime          += calls[i].Time;
                    list[id].TotalExclusiveTime += exclusiveTime;

                    var nodeAvg = exclusiveTime / (double)calls[i].CallCount;
                    list[id].PeakAvgTime   = Math.Max(nodeAvg, nodeAvg);
                    list[id].PeakFrameTime = Math.Max(calls[i].ExclusiveTime, list[id].PeakFrameTime);
                }

                for (int i = 0; i < ppLookup.Count; i++)
                {
                    list[i].FrameCount += nodeInframe[i];
                    nodeInframe[i]      = 0;
                }
            }

            var nodeStats = new List <PerfNodeStats>(ppLookup.Count - NetMsgIds.Count);

            Debug.Assert(Threadppid == 1);
            //Skip the shared Frame Thread node
            for (int i = 0; i < ppLookup.Count; i++)
            {
                var name = ppMap[i];

                if (NetMsgIds.Contains(i))
                {
                    continue;
                }

                var node = new PerfNodeStats(this, name, i);
                node.SetStats(list[i]);
                nodeStats.Add(node);
            }

            return(nodeStats);
        }
Beispiel #2
0
        public PerfNodeStats GetPeakNode()
        {
            int  peakIndex = -1;
            uint peak      = 0;

            for (int i = 1; i < Calls.Length; i++)
            {
                if (Calls[i].ExclusiveTime > peak)
                {
                    peak      = Calls[i].ExclusiveTime;
                    peakIndex = i;
                }
            }

            var node = new PerfNodeStats(Owner, Owner.ppMap[Calls[peakIndex].ppid], Calls[peakIndex].ppid);

            node.SetStats(Calls[peakIndex].ExclusiveTime, Calls[peakIndex].ExclusiveTime / Calls[peakIndex].CallCount, Calls[peakIndex].CallCount, 1);
            return(node);
        }
Beispiel #3
0
        public NodeStatsDiff(PerfNodeStats old, PerfNodeStats @new)
        {
            Old = old;
            New = @new;

            Change     = GetChangePercent(Old.AvgExclusiveTime, New.AvgExclusiveTime);
            PeakChange = GetChangePercent(Old.MaxAvgExclusiveTime, New.MaxAvgExclusiveTime);

            /*
             * TotalTime = TotalTime - other.TotalTime,
             * TotalExclusiveTime = TotalExclusiveTime - other.TotalExclusiveTime,
             * AvgExclusiveTime = AvgExclusiveTime - other.AvgExclusiveTime,
             * MaxAvgExclusiveTime = MaxAvgExclusiveTime - other.MaxAvgExclusiveTime,
             * PeakFrameTime = PeakFrameTime - other.PeakFrameTime,
             *
             * CallCount = CallCount - other.CallCount,
             * AvgCallCount = AvgCallCount - other.AvgCallCount,
             * NodeCount = NodeCount - other.NodeCount,
             * FrameCount = FrameCount - other.FrameCount,
             */
        }
Beispiel #4
0
 public NodeStatsDiff GetDiff(PerfNodeStats old)
 {
     return(new NodeStatsDiff(old, this));
 }