wu-sheng commented on a change in pull request #4332: Change profile stack
element data structure
URL: https://github.com/apache/skywalking/pull/4332#discussion_r376758126
##########
File path:
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profile/analyze/ProfileStackNode.java
##########
@@ -163,21 +166,24 @@ public ProfileStackElement buildAnalyzeResult() {
ProfileStackElement respElement = mergingPair.key;
// generate children node and add to stack and all node mapping
- respElement.setChildren(mergingPair.value.children.stream().map(c
-> {
- ProfileStackElement element = c.buildElement();
- Pair<ProfileStackElement, ProfileStackNode> pair = new
Pair<>(element, c);
+ for (ProfileStackNode children : mergingPair.value.children) {
+ ProfileStackElement element =
children.buildElement(idGenerator++);
+ element.setParentId(respElement.getId());
+
+ Pair<ProfileStackElement, ProfileStackNode> pair = new
Pair<>(element, children);
stack.add(pair);
nodeMapping.add(pair);
-
- return element;
- }).collect(Collectors.toList()));
+ }
}
// calculate durations
nodeMapping.parallelStream().forEach(t ->
t.value.calculateDuration(t.key));
nodeMapping.parallelStream().forEach(t ->
t.value.calculateDurationExcludeChild(t.key));
- return root;
+ ProfileStackTree tree = new ProfileStackTree();
+ tree.setElements(nodeMapping.stream().map(p ->
p.key).collect(Collectors.toList()));
Review comment:
This could be replaced by simplier `foreach`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services