Beispiel #1
0
        private async Task Initialize()
        {
            await this.semaphoreSlim.WaitAsync();

            try
            {
                if (this.initialized == 1)
                {
                    return;
                }

                this.deserializer = new TraceLogDeserializer(this.filename);

                this.stackEventTypes.Add(new StackEventTypeInfo(0, "All Events", this.deserializer.TotalEventCount, this.deserializer.TotalStackCount));

                foreach (var pair in this.deserializer.EventStats.OrderByDescending(t => t.Value.StackCount))
                {
                    this.stackEventTypes.Add(new StackEventTypeInfo(pair.Key, pair.Value.EventName, pair.Value.Count, pair.Value.StackCount));
                }

                float totalmsec = 0;
                foreach (var traceProcess in this.deserializer.TraceProcesses)
                {
                    totalmsec += traceProcess.CPUMSec;
                }

                this.processList.Add(new ProcessInfo("All Processes", (int)ProcessIndex.Invalid, totalmsec));

                foreach (var pair in this.deserializer.TraceProcesses.OrderByDescending(t => t.CPUMSec))
                {
                    this.processList.Add(new ProcessInfo(pair.Name + $" ({pair.ProcessID})", (int)pair.ProcessIndex, pair.CPUMSec));
                }

                this.initialized = 1;
            }
            finally
            {
                this.semaphoreSlim.Release();
            }
        }
Beispiel #2
0
        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();
            }
        }