Пример #1
0
        public IEnumerator <object> Build(HeapRecording instance, IEnumerable <DeltaInfo> deltas)
        {
            yield return(Future.RunInThread(() => {
                Parallel.ForEach(
                    deltas, (delta) => {
                    StackGraphNode parent = null, node;

                    foreach (var frame in delta.Traceback.Reverse())
                    {
                        if (parent != null)
                        {
                            node = parent.GetNodeForChildFrame(frame);
                        }
                        else
                        {
                            node = GetNodeForFrame(frame);
                        }

                        if (node != null)
                        {
                            node.Visit(delta);
                        }

                        if (node != null)
                        {
                            parent = node;
                        }

                        node = Functions.GetNodeForFrame(frame);
                        node.Visit(delta);
                    }
                }
                    );
            }));

            yield return(FinalizeBuild());
        }
Пример #2
0
        public StackGraphNode GetNodeForChildFrame(TracebackFrame frameInfo)
        {
            bool           isNew;
            StackGraphNode result;

            lock (Children)
                result = Children.GetNodeForFrame(frameInfo, out isNew);

            if (isNew)
            {
                lock (result.Parents)
                    result.Parents.Add(this);
            }

            return(result);
        }