Add support for FreeBSD's pmcstat callgraph format#502
Conversation
d1494f3 to
899184b
Compare
src/import/index.ts
Outdated
| } else if (fileName.startsWith('callgrind.')) { | ||
| console.log('Importing as Callgrind profile') | ||
| return importFromCallgrind(contents, fileName) | ||
| } else if (fileName.endsWith('.graph')) { |
There was a problem hiding this comment.
I think, because this is a generic name, I'd rather omit this bit. The files should still import successfully because of the system below, it'll just be slightly slower as it hits tries a bunch of stuff that doesn't work. I'm nervous about this breaking imports for other profile types that just happen to have a .graph extension
If there's a more specific file pattern (like .pmc.graph or something) that works, I'd be happy to take that
There was a problem hiding this comment.
The documentation for pmcstat uses .graph as the extension on the example file name so I used that, but I have no problem removing this extension matching shortcut.
There was a problem hiding this comment.
On second thought, I might as well make up some more specific file extension as you suggested to be consistent with the other formats and provide the shortcut in case it speeds up the process of importing larger traces. I'm not sure how big a trace would have to be to notice a difference, but it won't hurt :)
I've chosen the extension ".pmcstat.graph" rather than something like "pmcstat.txt" because pmcstat can also output other text formats for various uses. And I've updated the example in the commit message to match.
f5f5f84 to
c06b1b7
Compare
This eliminates the need for stackcollapse-pmc.pl and its dependency on Perl to import FreeBSD callgraphs. Tracing can be done completely with tools included in the base system. For example: ``` # kldload hwpmc # pmcstat -S instructions -O sample.out sleep 1 # pmcstat -R sample.out -G sample.pmcstat.graph ```
|
@ryan-moeller Sorry for the extreme delay on this, but I just published this to npm as v1.23.0 and this change is now live on https://www.speedscope.app/ |
This eliminates the need for stackcollapse-pmc.pl and its dependency on Perl to import FreeBSD callgraphs. Tracing can be done completely with tools included in the base system. For example:
To get
npm run jestto run on FreeBSD, I changed the shebang in scripts/test-setup.sh from /bin/bash to /bin/sh as FreeBSD does not have /bin/bash. The script uses no bash-specific features. This is done in a separate commit.