public void accumulateFrom(ProfileStack stack) {
        List<String> stackList = stack.getStack();
        if (codeSignature == null) {
            codeSignature = stackList.get(0);
        }
        // add detected stack
        this.detectedBy(stack);

        // handle stack children
        ProfileStackNode parent = this;
        for (int depth = 1; depth < stackList.size(); depth++) {
            String elementCodeSignature = stackList.get(depth);

            // find same code signature children
            ProfileStackNode childElement = null;
            for (ProfileStackNode child : parent.children) {
                if (Objects.equal(child.codeSignature, elementCodeSignature)) {
                    childElement = child;
                    break;
                }
            }

            if (childElement != null) {
                // add detected stack
                childElement.detectedBy(stack);
                parent = childElement;
            } else {
                // add children
                ProfileStackNode childNode = newNode();
                childNode.codeSignature = elementCodeSignature;
                childNode.detectedBy(stack);

                parent.children.add(childNode);
                parent = childNode;
            }
        }
    }
accumulate {@link ProfileStack} to this tree, it will invoke on the tree root node
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/analyze/ProfileStackNode.java