Profiling programs
Profiling using operf
- Ensure you have access to your kernel’s debug symbols. On Fedora, you can install these symbols with
sudo debuginfo-install kernel. - Run
sudo operf --system-wide --vmlinux /usr/lib/debug/lib/modules/KERNEL-VERSION/vmlinux, execute your experiments, and pressCtrl-C. - Run
opreport -l.
Profiling using gprof
Run a program and its children while collecting profiling data:
- Compile with GCC’s
-pgflag. - Run with
GMON_OUT_PREFIX=prefix ./a.out. - Run
gprof a.out prefix.PID.