public CallTreeData(ISymbolServerArtifactRetriever symbolServerArtifactRetriever, ISourceServerAuthorizationInformationProvider sourceServerInformationProvider, EtwDeserializer deserializer, StackViewerModel model) { this.symbolServerArtifactRetriever = symbolServerArtifactRetriever; this.sourceServerInformationProvider = sourceServerInformationProvider; this.deserializer = deserializer; this.model = model; }
private async Task Initialize() { await this.semaphoreSlim.WaitAsync(); try { if (this.initialized == 1) { return; } var filePath = this.locationType == FileLocationType.Url ? await this.DownloadFile(this.uri) : this.uri; this.deserializer = new EtwDeserializer(filePath); foreach (var pair in this.deserializer.EventStacks) { this.stackEventTypes.Add(new StackEventTypeInfo(pair.Key, pair.Value.EventName, pair.Value.SampleIndices.Count)); } foreach (var pair in this.deserializer.ImageLoadMap.OrderBy(t => t.Value.Sum(y => y.InstructionPointers.Count)).Reverse()) { long total = 0; foreach (var image in pair.Value) { total += image.InstructionPointers.Count; } this.processList.Add(this.deserializer.ProcessIdToNameMap.TryGetValue(pair.Key, out var processName) ? new ProcessInfo(processName, pair.Key, total) : new ProcessInfo($"Process {pair.Key}", pair.Key, total)); } this.initialized = 1; } finally { this.semaphoreSlim.Release(); } }