
Walks you through the full pipeline from perf or Callgrind output to SVG flamegraphs using Brendan Gregg's tools, then teaches you how to actually read them. Covers stackcollapse scripts, differential flamegraphs for before/after comparison, and the interpretation rules that matter: wide frames are hot, plateaus at the top are your real bottlenecks, tall stacks suggest recursion problems. The reading guide is honestly more valuable than the generation steps, since most people can make the SVG but don't know what the wide frame with narrow towers above it is trying to tell them. Includes options for consistent palettes and inverted icicle charts if you're into that.
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill flamegraphs --agent claude-codeInstalls into .claude/skills of the current project.
Guide agents through the pipeline from profiler data to SVG flamegraph, and teach interpretation of flamegraphs to drive concrete optimisation decisions.
git clone https://github.com/brendangregg/FlameGraph
# No install needed; scripts are in the repo
export PATH=$PATH:/path/to/FlameGraph
# Step 1: record
perf record -F 999 -g -o perf.data ./prog
# Step 2: generate script output
perf script -i perf.data > out.perf
# Step 3: collapse stacks
stackcollapse-perf.pl out.perf > out.folded
# Step 4: generate SVG
flamegraph.pl out.folded > flamegraph.svg
# Step 5: view
xdg-open flamegraph.svg # Linux
open flamegraph.svg # macOS
One-liner:
perf record -F 999 -g ./prog && perf script | stackcollapse-perf.pl | flamegraph.pl > fg.svg
Sponsors