Flame graph

A profiler picture where the widest stacks are the code paths consuming the most sampled CPU time.

where is my CPU time goingthe wide stacked bars from a profilerwhich function is making the app slowthe orange pyramid picture from a profilerthe chart that looks like flamesflame grahpthe picture with wide blocks stacked on top of each otherstacked call tree picture

See it

Live demo coming soon

What it is

A flame graph turns many sampled call stacks into stacked rectangles. Each box is a function, callers sit below callees, and width represents how often that function appeared in the samples. Wide towers are where the program spent time. Brendan Gregg created the format in 2011 while chasing a MySQL performance problem, so a huge profiler dump could be read at a glance. The warm random palette that gives the graph its name carries no meaning at all: width is the only thing to read.

Reach for one when CPU is high or a request is slow and a trace only tells you which operation is guilty, not which function inside it is burning cycles. Search for a function, follow a wide stack upward, then compare profiles before and after a change.

Gotcha: the horizontal position usually is not a timeline. Flame graph frames are commonly sorted to merge identical stacks; width is sample frequency, not duration along an x-axis. A flame chart is the time-ordered cousin. Sampling can also miss brief work, and off-CPU waiting needs an off-CPU or wall-clock profile rather than a CPU profile.

Ask AI for it

Capture a CPU flame graph for this Linux service under a representative load. Run perf record at 99Hz with call graphs enabled, convert the output with Brendan Gregg's FlameGraph scripts using perf script, stackcollapse-perf.pl, and flamegraph.pl, and save an interactive SVG. Preserve symbols and stack frames, label the profile with the release SHA and workload, and report the five widest leaf or terminal frames. Capture the same workload after the optimization and produce a differential flame graph so regressions are visible.

You might have meant

apmcontinuous profilingstack tracelatency percentiletrace