Callgrind parser: Fixed associating file names with symbols and detection of root nodes #466
+16
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces several small improvements to updating the current file name for the Callgrind parser:
cfn
) is within an inlined code block, it should use file names provided byfi
orfe
keys.fn
key is present, the parser should set the current file name to the value provided in the previousfl
key (such reset is also applied in KCacheGrind: link to code.fn
should be stored separately so that it is not overwritten later by newfl
calls.Those small modifications improve detection of root nodes. Before the PR, the same function could have several files associated with it - when
fi
/fe
are not taken into account, the file name for the current callee is taken from the lastfl
orcfi
call, which is later added tochildMap
inthis.childrenTotalWeights
instead of the actual function with its file name. After this, only one of the two representations of the same symbol get deleted fromrootNodes
.Without the improvement, we can observe detached call stacks for such "orphaned" functions. With the improvement, the functions have properly provided names, which leads to better generation of the call graph.
Some examples before and after applying the commit from the PR (the marked calls are for the same function):
Example 1 (callgrind file)
Example 2
Before:
After:
Example 3
This fixes #465