-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Export as callgrind capture
jrfonseca/gprof2dot is a pretty neat tool for visualizing profiling results as a call graph
Unfortunately, it does not support the firefox profiler format.
To get around this, I generated a script for converting samply's json.gz output to a callgrind.capture file: render_profile.py
This script rudimentary and barely tested but it serves as a reference for how it could be implemented within samply.
The only (free) windows profiler that I know that exports to callgrind is verysleepy. But that project is unmaintained and doesn't support rust very well. VerySleepy also lacked a way to export via cmd line which made it very tedious for automated profiling.
Im sure there are way more tools that are built to analyze callgrind files, so having this as an option in samply would make it compatible with many existing workflow. Combine that with the fact that unlike valgrind, samply already works on windows:🥇
Export as dot graph
Using the above script, I was able to convert the profile results of my windows rust app to a callgrind file.
But the callgrind file is not what I actually need, Its only an intermediate file so that I can use jrfonseca/gprof2dot
It would be pretty awesome if samply could just call the gprof2dot (if a flag like --as-dot is passed and gprof2dot executable exists in path)
Example:
Here is an example call graph I generated:

This is what I currently have to do to generate it:
- Install the master version of samply (it has the presymbolicate flag)
cargo install --git https://github.com/mstange/samply.git samply - record my application with the presymbolicate flag, and also specify where my server.pdb will be (target/debug)
samply.exe record --presymbolicate --symbol-dir=target\debug\ target\debug\server.exe - convert the profile.json.gz to a callgrind file with render_profile.py
python render_profile.py profile.json.gz - convert the callgrind file to dot file
gprof2dot --format=callgrind --output=out.dot profile.capture - convert the dot file to an svg
dot -Tsvg out.dot -o out.svg
It would be awesome if we could just do samply.exe record --as-svg target\debug\server.exe and it does all of that in one command ✨