Render a pprof profile as a single-file interactive SVG flamegraph. Takes input from a file, an HTTP URL, or stdin. Output is one SVG you can open in any browser, with hover-to-inspect frames and no external dependencies.
go install github.com/c-tonneslan/flamectl@latestOr build from this repo:
git clone https://github.com/c-tonneslan/flamectl
cd flamectl
go build .# from a profile file
flamectl cpu.pprof
# wrote flame.svg
# from a running Go service exposing pprof endpoints
flamectl http://localhost:6060/debug/pprof/profile?seconds=10
# from stdin
go tool pprof -proto -seconds 5 http://localhost:6060/debug/pprof/profile | flamectl -
# list the sample types in a profile so you can pick the right one
flamectl --list-samples heap.pprof
# focus on a specific call (case-insensitive substring match)
flamectl --focus database/sql cpu.pprof
# pick a different sample dimension (e.g. cpu nanoseconds instead of sample count)
flamectl --sample 1 cpu.pprofgo tool pprof -http=:8080 is the official answer, and it's a great interactive explorer. But sometimes you want one of:
- A single static SVG you can attach to a GitHub issue or paste into a Slack message.
- A flamegraph from a profile someone sent you, without firing up the full pprof web UI.
- A scriptable way to render flamegraphs in CI, where Brendan Gregg's flamegraph.pl needs a pre-processing step.
flamectl is that. ~600 lines of Go, one binary, no UI server.
- Parse the pprof protobuf using
github.com/google/pprof/profile. - Pick one of the sample-value dimensions (cpu nanoseconds, alloc objects, etc).
- Walk every sample, reverse the stack so the entry point is at the root, aggregate values into a call tree.
- Recursively lay out the tree: each node's width is its share of its parent's value; depth = vertical position; subtrees stack horizontally.
- Emit one self-contained SVG with embedded CSS and a tiny inline script that updates a "current frame" status line on hover.
Colors are a deterministic FNV hash of the function name mapped into the warm-red-orange-yellow palette that's traditional for CPU flamegraphs. Two functions with the same name always get the same color across runs, which makes diffing two flamegraphs by eye a lot easier.
- No flamechart (sorted-by-time-axis) mode. Just flamegraphs.
- No collapse-and-drill-down interaction in the SVG. The output is intentionally static-with-hover; if you want full drill-down, use
go tool pprof -http=:8080. - No symbolization beyond what pprof embeds. If the profile was recorded without symbols, you'll see addresses.
- No diff mode (yet). Would be useful, isn't here.
Pure Go. The only third-party dependency is github.com/google/pprof/profile, which is the same parser the official tool uses. SVG generation is hand-written.
MIT. Built by Charlie Tonneslan.
