flamegraph
visualization for profiled stack traces
TLDR
SYNOPSIS
flamegraph.pl [options] [input]
DESCRIPTION
FlameGraph is a visualization tool for profiled stack traces, created by Brendan Gregg. It generates interactive SVG graphs where the x-axis shows the stack population and the y-axis shows stack depth.
Flame graphs quickly reveal which code paths consume the most resources. They work with any profiler output that can be converted to the collapsed stack format.
PARAMETERS
--title text
Title for the graph.--subtitle text
Second level title (optional).--width pixels
SVG width (default 1200).--height pixels
Frame height (default 16).--minwidth pixels
Omit functions narrower than this (default 0.1 pixels).--fontsize num
Font size (default 12).--fonttype font
Font type (default "Verdana").--countname text
Count type label (default "samples").--nametype text
Name type label (default "Function:").--inverted
Generate icicle graph (top-down).--reverse
Reverse stack order.--colors palette
Color palette: hot (default), mem, io, wakeup, chain, java, js, perl, red, green, blue, aqua, yellow, purple, orange.--bgcolors color
Background gradient: yellow (default), blue, green, grey, or flat "#rrggbb".--hash
Color by function name hash.--cp
Use consistent palette (palette.map).--flamechart
Time-ordered flame chart (sort by time, do not merge stacks).--negate
Switch differential hues (blue/red).
WORKFLOW
perf record -g ./myapp
# 2. Convert to text stacks
perf script > out.perf
# 3. Collapse stacks
stackcollapse-perf.pl out.perf > stacks.txt
# 4. Generate flame graph
flamegraph.pl stacks.txt > flame.svg
CAVEATS
Requires Perl. Input must be in collapsed stack format (use stackcollapse-*.pl scripts to convert). Large profiles may produce complex graphs. Colors are randomized unless --hash or --cp is used. Interactive features (zoom, search) require an SVG-capable browser.
HISTORY
Flame graphs were invented by Brendan Gregg in 2011 while at Joyent for analyzing performance issues. The visualization technique has become standard for performance profiling across languages and platforms.
