Identify the sampled quantity first
A flame graph summarizes hierarchical data such as stack samples, with width representing an accumulated quantity. CPU samples, waiting durations, and allocation sizes can all produce similar-looking diagrams while measuring different things. Identify the quantity, units, target processes or threads, observation interval, and aggregation method first. A graph of on-CPU samples does not directly provide the complete distribution of off-CPU waiting time. Color and height are not universal labels for severity. Interpretation begins with the measurement transformed into the graph rather than with a visually striking rectangle or an assumption that every flame graph describes elapsed request latency.
The horizontal axis is not execution time
In a conventional flame graph, similar stacks are grouped horizontally rather than retained in execution order. A function displayed on the left did not necessarily run before a function on the right. Distinguish this from a flame chart that preserves time order. A wide region represents a large share of the chosen sampled quantity. Horizontal separation does not reveal whether two paths overlapped in wall-clock time. Use timestamped traces or another time-oriented view when chronology is the question. Reading the x-axis as a timeline changes the meaning of the visualization and can lead to an entirely invented execution story.
Parent width includes descendant work
In the usual orientation, lower frames are callers and higher frames are descendants on a call path. A parent’s width includes descendant work, so adding widths across every level double-counts the underlying quantity. In an illustrative set of one hundred samples, sixty might include parse and forty of those also include decode. Those are not one hundred independent samples of separate work. Distinguish self cost from inclusive cost. A broad entry function may simply invoke most of the application’s useful work. Follow its children to find concentrated paths before deciding that the parent itself is the operation to optimize.
Depth does not establish high cost
Stack height describes call depth, not the total amount of CPU consumed. A shallow but broad function can dominate the sampled quantity. Compiler optimization, inlining, missing symbols, and stack-unwinding limitations affect what appears in the graph. A large unknown region deserves investigation rather than being ignored while a tiny named function is optimized. Sampling also means that absence from one graph does not prove a function never ran. Check collection and symbolization conditions. The diagram is a summary of available evidence, including its blind spots, rather than a complete and exact account of every instruction executed during the request.
Compare equivalent work before and after
Match input, request count, concurrency, observation duration, and collection settings when comparing changes. A relative-width graph can make another function’s share grow simply because one component became cheaper. If parsing shrinks, serialization’s proportion can increase without serialization becoming slower. Compare absolute sampled quantities, elapsed time, and completed work as well. Consider profiling overhead and repeat measurements under comparable conditions. A broad path is a starting point for a testable hypothesis, such as avoidable repeated work, not proof that removing the function or shortening its name would improve the application.
Treat profile data as operational information
Profiles can contain function names, paths, and identifiers derived from program state. Inspect the collection scope and exported contents before sharing them, and avoid retaining unnecessary secrets or user information. Begin with a bounded observation suitable for the required diagnosis and record load and permissions. The one-hundred-sample example here is explanatory arithmetic, not a measurement of a particular service. Establish an optimization through controlled change and equal correct work, not only through an appealing graph. Producing a readable visualization and demonstrating a performance improvement are different outcomes with different evidence requirements.