We'll use the flamegraph crate to profile our executable using flamegraphs in Linux.
First, install the flamegraph crate globally:
cargo install flamegraphThen, enable perf stuff in Linux for flamegraphs:
echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid
echo 0 | sudo tee /proc/sys/kernel/kptr_restrictFinally, profile our executable in release mode:
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -F 100000 -- files/bench-data/listing_0042_completionist_decode tmp.txtThis samples it as much as it can, but currently, it's not super helpful because writing to the file is the bottleneck, the execution time is small, and I don't think our decode/execute code is ever really sampled.