Finding where CPU time goes A serializer dominates a hot path The new response formatter makes a familiar function look enormous on a flame graph. Rina follows the stack all the way down before rewriting the wrapper whose name spans the widest rectangle. The serializer accounts for twelve of a hundred CPU samples before the release and sixty-five during it. Those shares say where sampled processor time landed. They don't say how much processor time a completed response used. A sampling profiler interrupts execution at intervals and records the current stack. Repeated stacks estimate where the chosen event occurs. CPU sampler in context In a CPU flame graph, width represents samples aggregated below a frame, and vertical position represents call depth. The horizontal axis groups similar stacks and does not give the order of events. Sar provides interval or archived activity for CPU, memory, input and output and more. A coarse archive interval can average away a burst that caused a short deadline miss. Per-CPU statistics expose imbalance hidden by a node average. One saturated core can constrain a single-threaded loop while many other cores remain idle. Per-task interval statistics distinguish which process contributes CPU, faults or switching. Capture worker identity across restarts because PID reuse can join unrelated samples. Imagine one hundred on-CPU samples. Sixty include the request handler, and forty of those also include a serializer beneath it. The parent and child counts overlap because each sample is a complete call stack. Adding them as if they were separate intervals would exaggerate work. Read the width of a stack Decide whether CPU execution or some off-CPU wait can explain the symptom. Sample a bounded interval at representative load with usable symbols. Repeated event stacks become wider flame-graph frames. Measure CPU per completed request and the changed leaf path after the intervention. Stripped binaries can leave frequent stack frames unnamed. If the new release has poorer symbol coverage, named work can appear to vanish even while CPU cost stays constant. Record how many samples have usable symbols and whether the symbol files match the running build. Repeat a matched capture before crediting the optimization. Read the measurements Within the serializer, ask which frames are leaves and which simply lead to another costly function. Keep the sampled population and frequency stable between captures. If a new version improves throughput, a lower share of samples can still represent the same absolute CPU time under a larger workload. Compare CPU seconds per completed operation. Sixty-five serializer samples out of a hundred means sixty-five out of those sampled stacks included the serializer under the chosen definition. It does not mean every request spent sixty-five milliseconds there. A rare expensive request or a common modest cost can create the same share. Slice by request type or use trace correlation. Separate a busy parent from its costly child Could the serializer's share rise even if it performed exactly the same amount of work per request? Yes. Another component getting faster can change the denominator. Match workload and interval, then compare absolute CPU per completed request. Here the same payload is encoded repeatedly on one response path. If CPU per request stays flat while wall time grows, inspect off-CPU waits. Another thread’s optimization could have changed the sample fraction. Check the competing explanation A flame graph groups sampled stacks by their call paths. Width reflects sample weight for the selected event. Examine the hottest leaves and normalize by completed work. 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. Compare completed work, not just percentages Reusing a valid encoded representation reduces the serializer's share to fifteen samples per hundred. Perf samples chosen events such as CPU cycles. Compare event selection, sample rate, symbol coverage and completed work before treating two profiles as comparable. Rina verifies both CPU per response and latency, and checks that reuse never hands one customer another customer's representation. Apply the diagnosis If customers wait longer but CPU consumption stays flat, a CPU profile can faithfully miss the cause. Capture off-CPU waiting time or a request timeline targeted at the missing interval. A wide rectangle names a frequent stack in that sampling population. It does not automatically name a user-visible bottleneck.