This fixes a number of bugs with callgrind import. Dealing with this file format is a big pain because the documentation on https://www.valgrind.org/docs/manual/cl-format.html doesn't contain enough examples to disambiguate some of the behaviour, and because there's a fundamental impedance mismatch between call-trees and call-graphs.
In any case, after this PR, the behavior of callgrind file import is much better.
The file provided in #414 now imports correctly and, as far as I can tell, displays the same weights as what I see in KCacheGrind.
Some of the key changes:
Implementing subposition compression. This was just a TODO in the code that was never implemented
Fixing a misinterpretation of how fe and fi were intended to be used. Previously, I was using it to change the filename of a symbol, meaning that an fi or an fe line in the middle of a block describing costs for an fn would split a node in the call-graph into multiple nodes causing all manners of problems
Fixing a bug where cfn was persisting beyond a single call, also resulting in call graph nodes being split when they shouldn't be
coverage: 42.032% (+0.09%) from 41.946% when pulling 9e64cfa0ed33ec75191edd4d2006943ee32d8168 on jlfwong/callgrind-subposition into 8da9088ec1c93fd5cd5e4b7e8ddf06f400317636 on main.
This fixes a number of bugs with callgrind import. Dealing with this file format is a big pain because the documentation on https://www.valgrind.org/docs/manual/cl-format.html doesn't contain enough examples to disambiguate some of the behaviour, and because there's a fundamental impedance mismatch between call-trees and call-graphs.
In any case, after this PR, the behavior of callgrind file import is much better. The file provided in #414 now imports correctly and, as far as I can tell, displays the same weights as what I see in KCacheGrind.
Some of the key changes:
fe
andfi
were intended to be used. Previously, I was using it to change the filename of a symbol, meaning that anfi
or anfe
line in the middle of a block describing costs for anfn
would split a node in the call-graph into multiple nodes causing all manners of problemscfn
was persisting beyond a single call, also resulting in call graph nodes being split when they shouldn't beFixes #414