If, like me, you often find yourself struggling to compare two Google Profiler 
output graphs, you might find this<https://github.com/navsan/diff_profiles> 
little utility script I wrote helpful. It takes two dot files as input (Google 
profiler output files) and compares them using the cumulative_percentage 
attribute (or anything else you’d like). Functions whose cumulative_percentage 
has shown variation (positive or negative diffs) are colored red or green like 
a heatmap. As an added bonus, the script also does some heuristic hacks to 
improve readability of some long function names which break the standard 
demangler and pollute the profiler output with extra wide node boxes.

A sample diff output profile is attached. Take a look, try it out and let me 
know if you find it helpful or need some new features.

Here’s how to use it:
* Build quickstep with ENABLE_GOOGLE_PROFILER=true
* Run quickstep_cli_shell with -profile_name=“profile1.prof” and 
“profile2.prof” to get the two profile outputs. You often need/want to use two 
different binaries (like comparing feature_branch with master).
* Convert them to dot files using google-pprof.
google-pprof --dot /path/to/quickstep_cli_shell profile1.prof > profile1.dot
google-pprof --dot /path/to/quickstep_cli_shell profile2.prof > profile2.dot
* Run diff_profiles.
./diff_profiles.py profile1.dot profile2.dot -o profile_1vs2.dot
* Open the output.
dot -Tpdf profile_1vs2.dot -o profile_1vs2.pdf
open profile_1vs2.pdf

Cheers,
Nav


Reply via email to