/// <summary> /// Process the data from the data container set in the constructor. /// </summary> public void Load() { ApplicationTotals = new ProfilingStatisticsTotals(new Dictionary <StatisticsType, ulong>() { { StatisticsType.Sample, PDataContainer.TotalSamples }, { StatisticsType.Memory, PDataContainer.TotalAllocatedMemory }, { StatisticsType.Time, PDataContainer.TotalTime } }); ApplicationCpuUtilization = PDataContainer.CpuUtilizationHistory.CpuList; LoadThreads(); }
private IThreadStatisticsRaw BuildThreadStatisticsRaw(ThreadStatisticsData thread) { var totals = new ProfilingStatisticsTotals( new Dictionary <StatisticsType, ulong>() { { StatisticsType.Sample, thread.SamplesTotal }, { StatisticsType.Memory, thread.MemoryTotal }, { StatisticsType.Time, thread.TimeTotal } }); return(new ThreadStatisticsRaw { Totals = totals, Methods = thread.Methods.Values.ToList(), Lines = thread.Lines.Values.ToList(), CallTree = GetThreadCallTreeNodes(thread), CpuUtilization = ApplicationCpuUtilization.Count == 0 ? ApplicationCpuUtilization : thread.CpuUtilization }); }
private IThreadStatistics BuildThreadStatistics(ThreadStatisticsData thread) { var totals = new ProfilingStatisticsTotals( new Dictionary <StatisticsType, ulong>() { { StatisticsType.Sample, thread.SamplesTotal }, { StatisticsType.Memory, thread.MemoryTotal }, { StatisticsType.Time, thread.TimeTotal } }); var threadMethods = thread.Methods.Values; var methods = new Dictionary <StatisticsType, List <IMethodStatistics> > { { StatisticsType.Memory, threadMethods.Where(method => method.AllocatedMemoryExclusive > 0) .OrderByDescending(method => method.AllocatedMemoryExclusive) .ToList() }, { StatisticsType.Sample, threadMethods.Where(method => method.SamplesExclusive > 0) .OrderByDescending(method => method.SamplesExclusive) .ToList() }, { StatisticsType.Time, threadMethods.Where(method => method.TimeExclusive > 0) .OrderByDescending(method => method.TimeExclusive) .ToList() } }; var hotPaths = new Dictionary <StatisticsType, List <IHotPath> > { { StatisticsType.Memory, BuildThreadHotPaths(thread, StatisticsType.Memory, totals, HotPathThreshold) }, { StatisticsType.Sample, BuildThreadHotPaths(thread, StatisticsType.Sample, totals, HotPathThreshold) }, { StatisticsType.Time, BuildThreadHotPaths(thread, StatisticsType.Time, totals, HotPathThreshold) } }; var callTree = GetThreadCallTreeNodes(thread); var threadLines = thread.Lines.Values; var lines = new Dictionary <StatisticsType, List <ISourceLineStatistics> > { { StatisticsType.Memory, threadLines.Where(line => line.AllocatedMemoryInclusive > 0) .OrderByDescending(line => line.AllocatedMemoryInclusive) .ToList() }, { StatisticsType.Sample, threadLines.Where(line => line.SamplesInclusive > 0) .OrderByDescending(line => line.SamplesInclusive) .ToList() }, { StatisticsType.Time, threadLines.Where(line => line.TimeInclusive > 0) .OrderByDescending(line => line.TimeInclusive) .ToList() } }; return(new ThreadStatistics { Totals = totals, Methods = methods, CallTree = callTree, HotPaths = hotPaths, Lines = lines, CpuUtilization = ApplicationCpuUtilization.Count == 0 ? ApplicationCpuUtilization : thread.CpuUtilization }); }