Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.01 KB

File metadata and controls

32 lines (23 loc) · 1.01 KB

Profiling - Flamegraphs

We'll use the flamegraph crate to profile our executable using flamegraphs in Linux.

First, install the flamegraph crate globally:

cargo install flamegraph

Then, 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_restrict

(see this and this.)

Finally, profile our executable in release mode:

CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -F 100000 -- files/bench-data/listing_0042_completionist_decode tmp.txt

This 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.