cargo-flamegraph and flamegraph profile Linux, macOS, and Windows programs—including non-Rust binaries—and emit interactive SVG flamegraphs without Perl pipelines.
Overview
This project provides flamegraph and cargo-flamegraph binaries that sample stack traces and render interactive SVG flamegraphs. On Linux it relies on perf, on macOS on xctrace, and on Windows it defaults to the Blondie backend with optional DTrace when installed.
Users run cargo flamegraph or flamegraph against any command, then open the generated SVG in a browser because many image viewers lack interactive SVG support. Documentation explains perf parity settings for LLVM mold or lld linkers, unprivileged perf tuning, and debug symbol choices for release builds.
The tool can profile benchmarks, honor custom PERF or DTRACE binaries, and optionally use faster addr2line replacements. Shell completions exist for flamegraph on several shells.
Authors describe how to read widened stacks as hot code paths, aligning with broader systems performance workflows guided by flamegraphs.
Key features
- cargo and generic flamegraph CLI
- Linux perf sampling
- macOS xctrace integration
- Windows Blondie backend
- Interactive SVG output
- Release build profiling tips
- Custom perf binary paths
- Shell completion support
Use cases
- Finding Rust hot functions
- Profiling release binaries
- Comparing CPU regressions
- Visualizing perf stacks