private async Task Initialize() { await this.semaphoreSlim.WaitAsync(); try { if (this.initialized == 1) { return; } var d = new TraceLogDeserializer(this.filename); { var traceProcesses = d.TraceProcesses; var plist = new ProcessInfo[traceProcesses.Count + 1]; float totalmsec = 0; int i = 1; foreach (var traceProcess in traceProcesses.OrderByDescending(t => t.CPUMSec)) { totalmsec += traceProcess.CPUMSec; plist[i++] = new ProcessInfo(traceProcess.Name + $" ({traceProcess.ProcessID})", (int)traceProcess.ProcessIndex, traceProcess.CPUMSec, traceProcess.ProcessID, traceProcess.ParentID, traceProcess.CommandLine); } plist[0] = new ProcessInfo("All Processes", (int)ProcessIndex.Invalid, totalmsec, -1, -1, string.Empty); this.processList = plist; } { var eventStats = d.EventStats; var stackEventTypes = new StackEventTypeInfo[eventStats.Count]; int i = 0; foreach (var pair in d.EventStats.OrderBy(t => t.Value.FullName)) { stackEventTypes[i++] = new StackEventTypeInfo(pair.Key, pair.Value.FullName, pair.Value.Count, pair.Value.StackCount); } this.stackEventTypesOrderedByName = stackEventTypes; } { var eventStats = d.EventStats; var stackEventTypes = new StackEventTypeInfo[eventStats.Count + 1]; stackEventTypes[0] = new StackEventTypeInfo(0, "All Events", d.TotalEventCount, d.TotalStackCount); int i = 1; foreach (var pair in d.EventStats.OrderByDescending(t => t.Value.StackCount)) { stackEventTypes[i++] = new StackEventTypeInfo(pair.Key, pair.Value.FullName, pair.Value.Count, pair.Value.StackCount); } this.stackEventTypesOrderedByStackCount = stackEventTypes; } { var moduleFiles = d.TraceModuleFiles; var moduleInfos = new ModuleInfo[moduleFiles.Count]; int index = 0; foreach (var moduleFile in moduleFiles.OrderByDescending(t => t.CodeAddressesInModule)) { moduleInfos[index++] = new ModuleInfo((int)moduleFile.ModuleFileIndex, moduleFile.CodeAddressesInModule, moduleFile.FilePath); } this.moduleInfoList = moduleInfos; } this.traceInfo = d.TraceInfo; this.deserializer = d; this.initialized = 1; } finally { this.semaphoreSlim.Release(); } }
public DetailedProcessInfo(ProcessInfo processInfo, List <ThreadInfo> threads, List <ModuleInfo> modules) { this.ProcessInfo = processInfo; this.Threads = threads; this.Modules = modules; }