← All open source projects

FlameGraph

brendangregg/FlameGraph

FlameGraph is Brendan Gregg’s script collection for visualizing execution profiles as flame graphs.

Forks 2,106
Author brendangregg
Language Perl
License Unknown
Synced 2026-06-27

What It Is

FlameGraph is Brendan Gregg’s repository of scripts for building flame graphs. These graphs help show which execution paths consume the most time or memory.

The idea became popular in systems performance because it replaces long function tables with the shape of load. Wide blocks immediately show where investigation should start.

What Is Inside

The repository contains scripts for collapsing stacks from different sources and generating SVG output. It works with data from Linux perf, DTrace, SystemTap, Xcode Instruments, Xperf, and other profilers.

The usual path has three steps: collect stacks, collapse them into folded format, and generate an SVG. The result opens in a browser, supports zooming, and can search for functions.

How People Use It

FlameGraph is used to investigate high CPU usage, memory issues, slow requests, and unexpected latency. It is especially useful when the expensive part of a program is unclear.

The tool does not replace a profiler; it visualizes already collected samples. The result depends on how the data was captured and whether the load was representative.

Example

The example shows the classic Linux path: record a profile with perf, unfold the stacks, and generate an SVG graph.

Building A Flame Graph

The commands record a profile, collapse stacks, and create an SVG that can be opened in a browser.

Language: Bash
perf record -F 99 -a -g -- sleep 60
perf script > out.perf
./stackcollapse-perf.pl out.perf > out.folded
./flamegraph.pl out.folded > flamegraph.svg

Strengths And Limits

FlameGraph’s strength is immediate readability. Even a large system becomes easier to reason about when hot paths take more visual space.

The limit is interpretation. A flame graph shows where samples accumulated, but the fix still requires knowledge of the application, workload, and cost of change.

Project Context

FlameGraph is maintained in the brendangregg/FlameGraph repository; its public project history starts on 2011-12-16. GitHub reports the primary language as Perl, and the license as not specified. The project also has a dedicated site: http://www.brendangregg.com/flamegraphs.html.

For a catalog page, this context matters because the reader sees a real project with an owner, license, technical base, and public change history rather than an abstract name.