Finding where CPU time goes
medium 6 minA sampling profiler interrupts execution at intervals and records the current stack.
Where it shows up
The same pattern appears across everyday software.
A serializer dominates a hot path
After changing response formatting, CPU and latency rise at fixed request rate. Compare equal-duration profiles from matched versions and normalize by completed requests. A wide parent can enclose several expensive children. Identify the leaf work before optimizing the parent. A CPU profile will underrepresent time spent blocked off CPU.
Verifying the intervention
Reuse the encoded representation where valid, then compare absolute CPU per request and the new profile. If CPU per request stays flat while wall time grows, inspect off-CPU waits. Another thread’s optimization could have changed the sample fraction.