flame-graph-analyzer
БесплатноБез исполняемых скриптовНе проверенUse for any question or task about reading a flame graph or CPU profile, including finding the hot path after a slow release or a regression traced to one…
от testland★ 18 звёзд на GitHubОб этом скилле
flame-graph-analyzer
Overview
Canonical flame-graph reference: brendan-gregg-flame. The widest leaf (bottom of the stack) is the hot path.
Each runtime produces flame graphs from its own profiler - py-spy (Python),
async-profiler (JVM), Go's built-in pprof, clinic.js flame (Node.js), and
perf / eBPF (native C/C++/Rust). This skill is language-agnostic: it
consumes the profiler output (SVG, JSON, or folded-stacks .txt) and surfaces
a hypothesis the engineer can act on. Per-runtime capture commands live in
references/capturing-and-interpreting-flame-graphs.md.
When to use
- A perf regression has been bisected but the introducing commit touches multiple functions; the team needs to know which function is the actual hot path.
- A load test under
k6-load-testingor a sibling shows latency growth, but the API code hasn't visibly changed - the flame graph reveals the runtime cause. - A production incident showed CPU saturation; the team has captured a profile and needs to triage before reducing fleet size.
- An
EXPLAIN ANALYZEtrace suggests CPU is the bottleneck rather than I/O - the flame graph confirms.
How to use
- Capture a profile under realistic load with the runtime's profiler and export folded stacks - per-runtime capture commands in references/capturing-and-interpreting-flame-graphs.md.
- Sort the folded stacks by sample count and read the top 5 leaves (the actual working code, not framework wrappers).
- Classify each hot leaf's sample-time signature (CPU-bound vs allocator pressure vs lock contention vs I/O-misclassified) using the table below.
- Propose the next step for the dominant leaf; the category-to-fix remediation catalog is in references/capturing-and-interpreting-flame-graphs.md.
- Re-profile after the change to confirm the delta, then hand off to
perf-budget-gateto confirm the regression delta closes.
Reading the hot path
Read the folded stacks (or extract them from the SVG / JSON), sort by sample count, and identify the top leaves - the bottom-of-stack frames that are the actual working code, not framework wrappers:
# top 5 leaves by sample count
sort -k2 -n -r folded.txt | head -5
Each hot leaf's sample-time signature points to one category:
| Category | Signature in the flame graph |
|---|---|
| CPU-bound (hot algo) | A wide leaf in user code (a regex, a JSON serializer, a hash function). |
| Allocator pressure | Wide GC frames (gc::scavenge, Java GC, gc.collect). |
| Lock contention | Wide synchronization frames (pthread_mutex_lock, Object.wait, parking). |
| I/O wait misclassified | On-CPU profilers don't show I/O blocks; switch to wall-clock profiling. |
| Reflection / dynamic dispatch | Wide reflection.invoke, method_missing, getattr chains. |
| Logging overhead | Wide log.format, Logger.debug, serialization for log lines. |
Worked example
A Node.js endpoint regressed after a bisected commit. Capture under load, then read the hot path end to end.
Capture (Node.js clinic.js flame; other runtimes in the reference):
npx clinic flame -- node app.js
# drive load against the process, then stop it; clinic writes flame.html + folded stacks
Sort the folded stacks and read the top leaves:
sort -k2 -n -r folded.txt | head -5
main;handleRequest;serializeJson;JSON.stringify 4521
main;handleRequest;dbQuery;Array.from 2103
main;handleRequest;dbQuery;parseRows 1832
main;authCheck;jwt.verify;crypto.createHash 904
main;handleRequest;serializeJson;Buffer.from 312
Emit the analysis:
## Flame graph analysis - `flame.html`
**Runtime:** node
**Profile duration:** 30s under load
| Rank | Sample share | Stack (leaf) | Category |
|-----:|-------------:|---------------------------------------|----------|
| 1 | 38% | `JSON.stringify` (in `serializeJson`) | CPU-bound hot algo |
| 2 | 17% | `Array.from` (in `dbQuery`) | Allocator pressure |
| 3 | 15% | `parseRows` (in `dbQuery`) | CPU-bound hot algo |
| 4 | 8% | `jwt.verify` (in `authCheck`) | CPU-bound hot algo (crypto) |
| 5 | 3% | `Buffer.from` (in `serializeJson`) | Allocator pressure |
### Hypothesis
The serialization path is load-bearing: rank 1 (`JSON.stringify`, 38%) plus
rank 5 (`Buffer.from`, 3%) account for ~41% of sampled time combined.
### Recommended next step
1. Switch to a streaming JSON serializer (`fast-json-stringify` in Node,
`orjson` in Python, Jackson's `JsonGenerator` in the JVM) to eliminate the
intermediate string allocation.
2. Re-profile; expect ra
Установить flame-graph-analyzer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл flame-graph-analyzer?
Use for any question or task about reading a flame graph or CPU profile, including finding the hot path after a slow release or a regression traced to one commit. Reads flame graphs and profiles from py-spy, async-profiler, Go pprof or clinic.js, finds the hottest frames, tells CPU-bound from lock contention or allocation pressure and suggests the next step.
Как установить скилл flame-graph-analyzer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл flame-graph-analyzer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic