public TreeNode GetCallerTreeNode(string name, string path = "")
        {
            lock (this.lockobj)
            {
                CallTreeNodeBase node = this.GetNode(name).BackingNode;
                TreeNode         callerTreeNode;

                if (this.callerTreeCache.ContainsKey(node))
                {
                    callerTreeNode = this.callerTreeCache[node];
                }
                else
                {
                    callerTreeNode = new TreeNode(AggregateCallTreeNode.CallerTree(node));
                    this.callerTreeCache.Add(node, callerTreeNode);
                }

                if (string.IsNullOrEmpty(path))
                {
                    return(callerTreeNode);
                }

                var pathArr      = path.Split('/');
                var pathNodeRoot = callerTreeNode.Children[int.Parse(pathArr[0])];

                for (int i = 1; i < pathArr.Length; ++i)
                {
                    pathNodeRoot = pathNodeRoot.Children[int.Parse(pathArr[i])];
                }

                return(pathNodeRoot);
            }
        }
示例#2
0
        private async ValueTask <TreeNode> GetCallerTreeNode(string name, char sep, string path = "")
        {
            if (name == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(name));
            }

            await this.EnsureInitialized();

            var t = this.tuple;

            var node = this.GetNodeInner(name, t);

            lock (this.lockObj)
            {
                CallTreeNodeBase backingNode = node.BackingNode;
                TreeNode         callerTreeNode;

                var c = t.CallerTreeCache;

                if (c.ContainsKey(backingNode))
                {
                    callerTreeNode = c[backingNode];
                }
                else
                {
                    callerTreeNode = new TreeNode(AggregateCallTreeNode.CallerTree(backingNode));
                    c.Add(backingNode, callerTreeNode);
                }

                if (string.IsNullOrEmpty(path))
                {
                    return(callerTreeNode);
                }

                var pathArr      = path.Split(sep);
                var pathNodeRoot = callerTreeNode.Children[int.Parse(pathArr[0])];

                for (int i = 1; i < pathArr.Length; ++i)
                {
                    pathNodeRoot = pathNodeRoot.Children[int.Parse(pathArr[i])];
                }

                return(pathNodeRoot);
            }
        }
示例#3
0
        public async ValueTask <TreeNode> GetCallerTreeNode(string name, string path = "")
        {
            if (name == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(name));
            }

            var node = await this.GetNode(name);

            lock (this.lockobj)
            {
                CallTreeNodeBase backingNode = node.BackingNode;
                TreeNode         callerTreeNode;

                if (this.callerTreeCache.ContainsKey(backingNode))
                {
                    callerTreeNode = this.callerTreeCache[backingNode];
                }
                else
                {
                    callerTreeNode = new TreeNode(AggregateCallTreeNode.CallerTree(backingNode));
                    this.callerTreeCache.Add(backingNode, callerTreeNode);
                }

                if (string.IsNullOrEmpty(path))
                {
                    return(callerTreeNode);
                }

                var pathArr      = path.Split('/');
                var pathNodeRoot = callerTreeNode.Children[int.Parse(pathArr[0])];

                for (int i = 1; i < pathArr.Length; ++i)
                {
                    pathNodeRoot = pathNodeRoot.Children[int.Parse(pathArr[i])];
                }

                return(pathNodeRoot);
            }
        }
示例#4
0
        /// <summary>
        /// Get the set of caller nodes for a specified symbol.
        /// </summary>
        /// <param name="symbolName">The symbol.</param>
        public CallTreeNode GetCallers(string symbolName)
        {
            var focusNode = FindNodeByName(symbolName);

            return(AggregateCallTreeNode.CallerTree(focusNode));
        }