DevTools Logo

Flamegraph Generator

Flamegraph Generator

Turn folded stack samples into an interactive SVG flamegraph with zoom, search and offline export.

Runs in your browser
Try an example

Folded stacks

One sample per line: frame;frame;leaf count. Missing counts default to 1. Up to 5 million characters.

Flamegraph

Paste folded stacks to draw a flamegraph

Try the profile sample, or use the download for an offline-interactive SVG.

Details

A flamegraph shows where time goes: every rectangle is a stack frame and its width is the share of samples in which that frame appears. Paste the folded format used by stackcollapse-perf.pl, async-profiler and pprof — one stack per line, frames separated by semicolons, followed by a sample count. The tool builds a prefix tree, aggregates duplicate paths and draws the result immediately. Click any rectangle to zoom into its subtree, search a frame name to see matching coverage, flip to reverse orientation and download a standalone SVG that keeps its hover and click behavior when opened offline. Counts are optional (they default to 1), fractional counts are rounded and invalid lines are reported. All processing happens in the tab; the exported SVG embeds your samples, so handle it like any other profile artifact.

More examples

From perf

perf script | stackcollapse-perf.pl > folded.txt

main;parse;tokenize 4
main;render;layout 5

Paste the folded file's contents; the generator takes it from there.

Click to zoom

main;render;layout;paint 2
main;render;layout;measure 5

→ click 'render' → breadcrumb: (root) › main › render

Zoom re-roots the graph so the selected subtree fills the full width.

Search coverage

search: malloc
→ 12.4% coverage across 3 matching frames

Matching frames are highlighted magenta and only top-most matches count once toward coverage.

Offline SVG

Download SVG → open locally → hover and click still work

The export embeds its data and script, with no external CSS or network dependency.

    Examples

    Zoom into a hot frame

    Input
    main;render;layout 5
    main;render;paint 2
    Output
    click 'render' → subtree fills the canvas

    Zoom re-roots at the selected frame while preserving the ratios beneath it.

    Search coverage

    Input
    search: layout
    Output
    matching frames highlighted magenta · coverage shown as %

    Only top-most matches contribute once to coverage, avoiding double counting.

    Unfolded paste

    Input
    perf event 12
    other event 8
    Output
    warning: input looks unfolded

    A flat count table still renders but the tool tells you how to fold real profiler output.

    About this tool

    Flamegraph Generator turns folded stack samples into an interactive flamegraph without a Perl pipeline. Paste lines in the `frame;frame count` format used by perf, async-profiler and pprof; the browser aggregates identical paths into a prefix tree and draws a rectangle for every frame.

    Rectangle width is the share of total samples, so wide platforms are the hot paths. Click a frame to zoom into its subtree, search a name to highlight matches and see coverage, flip orientation, and download a standalone SVG that remains interactive offline.

    Counts are tolerant: missing counts become 1, fractional counts round, and invalid lines are reported instead of silently corrupting totals. Everything runs in the tab; the exported SVG embeds your data, so treat it like any other profile artifact.

    What this tool does not do

    • Folded stacks have no time axis; drag-select time-span zoom is not meaningful here.
    • Differential (red/blue) flamegraphs are not supported in this version.
    • The standalone SVG's click-to-zoom works when opened directly as a file, not when embedded as an HTML image.
    • Input is capped at 5 million characters to keep the tab responsive.

    How to use this tool

    1. Fold your profile

      For perf, run perf script | stackcollapse-perf.pl; for Java or Go tools, export their folded-stack format.

    2. Paste or load an example

      One sample per line, frames separated by semicolons and an optional trailing count.

    3. Explore the graph

      Click a rectangle to zoom, use the breadcrumb to return and search frame names to highlight matching paths.

    4. Download the SVG

      Save a self-contained file with embedded data and script for a postmortem or incident doc.

    Use cases

    Incident postmortems

    Attach a self-contained interactive SVG to the doc without a local toolchain.

    Perf triage

    Find the widest cumulative path and zoom into the frames that matter.

    Teaching profiling

    Show how self time and cumulative time differ by hovering frames.

    Folded stack input

    LineMeaning
    main;parse;tokenize 4Three frames, 4 samples
    main;render 3Missing deeper frames
    allocNo trailing count
    main; 0Empty or zero stack

    Duplicate paths aggregate into the same tree node; sub-pixel rectangles are hidden with a visible count.

    Common mistakes

    Mistake:Pasting raw `perf script` output.

    Fix:Fold it first with stackcollapse-perf.pl; the tool detects and warns about unfolded input.

    Mistake:Reading width as self time.

    Fix:Rectangle width is cumulative samples; hover for both cumulative and self counts.

    Mistake:Ignoring hidden sub-pixel frames.

    Fix:Check the hidden-frame count and zoom in before concluding a path is cold.

    Mistake:Sharing a downloaded SVG publicly.

    Fix:It embeds your frame names and sample counts — review it before publishing.

    Frequently asked questions

    What input format does this accept?

    The folded format: one line per sample, frames separated by semicolons from root to leaf, with a trailing count. For example `main;parse;tokenize 4`. perf, async-profiler and pprof tools can all export it.

    How do I fold perf output?

    Run `perf record -g` and then `perf script | stackcollapse-perf.pl > folded.txt`. Paste the resulting lines here. A line without a count is treated as one sample, but folding gives accurate weights.

    What does rectangle width mean?

    Width is cumulative: the fraction of total samples whose stack contains that frame. Self time is the part attributed to the frame itself and appears when you hover. Depth is the call-chain level.

    Does the downloaded SVG stay interactive offline?

    Yes. The export embeds its data and script, so hovering, click-to-zoom and the breadcrumb work when you open the SVG directly in a browser. Embedding it with an HTML `<img>` tag disables scripts by browser design.

    Why are some frames missing?

    Rectangles narrower than one pixel are pruned to keep the graph responsive; the tool shows how many were hidden. Zoom into a hot frame to bring its children back into view.

    Is my profile data uploaded?

    No. Parsing, aggregation and rendering happen entirely in your browser tab. The downloaded SVG contains your frame names and counts, so review it before sharing outside your team.

    References & standards