I found the instructions in this reddit comment by the user fn_rust. Dependencies:
The instructions are illustrated on the rb
crate:
- Build a binary with debug symbols (no
--release
flag was given):cargo build --example saw
- Run it with valgrind:
valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --simulate-cache=yes ./target/debug/examples/saw
- Convert the graph into a png:
gprof2dot --format=callgrind callgrind.out.9815 | dot -o callgrind-graph.png -Tpng
- Done!