perf record Turns a Mystery CPU Spike Into a Function Name

When CPU goes to 100 percent and your metrics show nothing, sampling the kernel's own profiler for thirty seconds will hand you the exact function responsible.

Share
perf record Turns a Mystery CPU Spike Into a Function Name. Abstract tooling illustration in orange and dark grey on debugly.dev
Flag Meaning
-F 99 99 samples per second. Odd number avoids lockstep with timers
-g Capture call stacks, not just leaves
-p PID Limit to the suspect process, keeps the output small
-- sleep 30 Stop after thirty seconds

Related reading: hyperfine Will Tell You the Build Got Slower and By How Much explores a connected angle.

Related reading: Ten bpftrace One Liners That Replace a Week of Guessing explores a connected angle.

Published on debugly.dev by Rohit Bhadani | Founder of Krova Cloud