Callgrind files produced by Valgrind with instruction-level profiling declare:
In this instance, each cost line has two position fields; instruction address and line
number before the actual cost values.
Example:
The parser hardcoded numPositionFields = 1, so it treated the line number
column as a cost value. This causes subsequent subposition-compressed lines
(e.g. * * 1042) to be misaligned, resulting in the following error when loading the file.
Failed to load format Error: Unrecognized line "* * " on line 136 parse
To reproduce:
Load any callgrind file that contains positions: instr line
in the header (e.g. output from valgrind --tool=callgrind --collect-jumps=yes).
I do have a patch ready and working with my profiling results. The fix includes the following:
- Parses the
positions: header to set the correct number of position fields
- Handles hex instruction addresses (e.g.
0x4d10)
- Handles jump specification lines (
jcnd, jump, jfi, jfl, jfn)
- Resolves two existing TODOs in
parseCostLine
Happy to open a PR if this issue is approved. Fix is currently available here with npm run jest -- --testPathPatterns=callgrind tests passing.
https://github.com/InkbridgeNetworks/speedscope/tree/callgrind-import-patch
Callgrind files produced by Valgrind with instruction-level profiling declare:
In this instance, each cost line has two position fields; instruction address and line
number before the actual cost values.
Example:
The parser hardcoded
numPositionFields = 1, so it treated the line numbercolumn as a cost value. This causes subsequent subposition-compressed lines
(e.g.
* * 1042) to be misaligned, resulting in the following error when loading the file.To reproduce:
Load any callgrind file that contains
positions: instr linein the header (e.g. output from
valgrind --tool=callgrind --collect-jumps=yes).I do have a patch ready and working with my profiling results. The fix includes the following:
positions:header to set the correct number of position fields0x4d10)jcnd,jump,jfi,jfl,jfn)parseCostLineHappy to open a PR if this issue is approved. Fix is currently available here with
npm run jest -- --testPathPatterns=callgrindtests passing.https://github.com/InkbridgeNetworks/speedscope/tree/callgrind-import-patch