MCPcopy Index your code
hub / github.com/nodejs/node / cloneSubtree

Method cloneSubtree

deps/v8/tools/profile.mjs:1085–1096  ·  view source on GitHub ↗

* Creates a subtree by cloning and merging all subtrees rooted at nodes * with a given label. E.g. cloning the following call tree on label 'A' * will give the following result: * * -- * /

(label)

Source from the content-addressed store, hash-verified

1083 * @param {string} label The label of the new root node.
1084 */
1085 cloneSubtree(label) {
1086 const subTree = new CallTree();
1087 this.traverse((node, parent) => {
1088 if (!parent && node.label != label) {
1089 return null;
1090 }
1091 const child = (parent ? parent : subTree).findOrAddChild(node.label);
1092 child.selfWeight += node.selfWeight;
1093 return child;
1094 });
1095 return subTree;
1096 }
1097
1098 /**
1099 * Computes total weights in the call graph.

Callers 1

getTreeProfile_Method · 0.80

Calls 2

traverseMethod · 0.95
findOrAddChildMethod · 0.45

Tested by

no test coverage detected