Reading a Sample-Based CPU Profile

A sampling profiler periodically observes where execution is active. Frequent sampled stacks can suggest which portions account for CPU work.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace an ordinary profile
  2. Recognize uncertainty
  3. Interpret one frame appearing in several sampled call paths
  4. Treat sample counts as estimates with a scope

Trace an ordinary profile

If many samples include quantity parsing beneath a report call, that path is a candidate for investigation. Nested call traces describe how those frames relate.

Recognize uncertainty

A short or infrequently observed computation may be missed. CPU samples also do not automatically attribute time spent blocked. See elapsed and CPU time.[1]

Interpret one frame appearing in several sampled call paths

A sampling profiler observes stacks during execution. If the parser appears on 40 of 100 CPU samples, it was active often under that sampling policy. A frequent ancestor can include time in child routines. See inclusive and self time.

Sample 1: request → parser → decode
Sample 2: request → parser → split
Sample 3: request → render
Parser appears in two of these sample stacks

Treat sample counts as estimates with a scope

A CPU profile may say little about waiting if it samples only executing threads. A small sample can miss short frequent operations. Use the profile to choose a narrower experiment.

References

  1. Google, Site Reliability Engineering ↩