Exemple #1
0
        public async ValueTask <StackSource> GetDrillIntoStackSource(bool exclusive, string name, char sep, string path = "")
        {
            var node = await this.GetCallerTreeNode(name, sep, path);

            var callTreeNode = node.BackingNode;

            var originalStackSource  = callTreeNode.CallTree.StackSource;
            var drillIntoStackSource = new CopyStackSource(originalStackSource);

            callTreeNode.GetSamples(exclusive, index =>
            {
                drillIntoStackSource.AddSample(originalStackSource.GetSampleByIndex(index));
                return(true);
            });

            return(drillIntoStackSource);
        }
Exemple #2
0
        public async ValueTask <ICallTreeData> GetCallTreeAsync(StackViewerModel model, StackSource stackSource = null)
        {
            await this.EnsureInitialized();

            lock (this.callTreeDataCache)
            {
                if (!this.callTreeDataCache.TryGetValue(model, out var value))
                {
                    double start = string.IsNullOrEmpty(model.Start) ? 0.0 : double.Parse(model.Start);
                    double end   = string.IsNullOrEmpty(model.End) ? 0.0 : double.Parse(model.End);

                    var key = new StackSourceCacheKey((ProcessIndex)int.Parse(model.Pid), int.Parse(model.StackType), start, end, model.DrillIntoKey);
                    if (!this.stackSourceCache.TryGetValue(key, out var ss))
                    {
                        ss = stackSource ?? this.deserializer.GetStackSource((ProcessIndex)int.Parse(model.Pid), int.Parse(model.StackType), start, end);
                        this.stackSourceCache.Add(key, ss);
                    }
                    else
                    {
                        var drillIntoStackSource = new CopyStackSource(GetTraceEventStackSource(ss));

                        ss.ForEach(delegate(StackSourceSample sample)
                        {
                            drillIntoStackSource.AddSample(sample);
                        });

                        ss = drillIntoStackSource;
                    }

                    value = new CallTreeData(stackSource ?? ss, model);
                    this.callTreeDataCache.Add(model, value);
                }

                return(value);
            }
        }