Example #1
0
        private static List <IHotPathItem> CallPath(FunctionCall call)
        {
            var result = new List <IHotPathItem>();

            for (var prev = call.Parent; prev != null; prev = prev.Parent)
            {
                result.Add(new HotPathItem {
                    Name = prev.Name
                });
            }

            return(result);
        }
Example #2
0
        private void UpdateCallTree(ThreadStatisticsData threadData, Sample sample)
        {
            var call = threadData.CallTreeRoot;

            call.SamplesInclusive         += sample.Samples;
            call.TimeInclusive            += sample.Time;
            call.AllocatedMemoryInclusive += sample.AllocatedMemory;

            var x = sample.StackItems;

            if (x.Count <= 1)
            {
                call.SamplesExclusive         += sample.Samples;
                call.TimeExclusive            += sample.Time;
                call.AllocatedMemoryExclusive += sample.AllocatedMemory;
            }

            for (int i = x.Count - 2; i >= 0; i--)
            {
                var si    = x[i];
                var child = call.FindChildById(si.FunctionIntId);
                if (child == null)
                {
                    var function = PDataContainer.GetFunction(si.FunctionIntId);
                    child = new FunctionCall(si.FunctionIntId, function.Name, function.Signature)
                    {
                        Parent = call,
                    };

                    call.Children.Add(child);
                    threadData.FunctionCalls.Add(child);
                }

                child.SamplesInclusive         += sample.Samples;
                child.TimeInclusive            += sample.Time;
                child.AllocatedMemoryInclusive += sample.AllocatedMemory;

                if (i == 0)
                {
                    child.SamplesExclusive         += sample.Samples;
                    child.TimeExclusive            += sample.Time;
                    child.AllocatedMemoryExclusive += sample.AllocatedMemory;
                }

                call = child;
            }
        }
Example #3
0
        private static ulong FunctionCallValue(FunctionCall call, StatisticsType statisticsType)
        {
            switch (statisticsType)
            {
            case StatisticsType.Memory:
                return(call.AllocatedMemoryExclusive);

            case StatisticsType.Sample:
                return(call.SamplesExclusive);

            case StatisticsType.Time:
                return(call.TimeExclusive);

            default:
                return(0);
            }
        }