Avoid annoying security settings:
sudo sh -c 'echo 0 >> /proc/sys/kernel/kptr_restrict'
sudo sh -c 'echo 0 > /proc/sys/kernel/nmi_watchdog'
sudo sh -c 'echo -1 > /proc/sys/kernel/perf_event_paranoid'
echo 1 | sudo tee /proc/sys/kernel/sched_schedstats
RUSTFLAGS=-g perf record --call-graph dwarf cargo bench ...
perf record -p <PID>
CPU utilization is lower than expected?
sudo perf record -e sched:sched_stat_sleep -e sched:sched_switch -e sched:sched_process_exit -g -o ~/perf.data.raw ./a.out
- Use Hotspot for correct/fast symbol demangling