Diagnose why a production service is running slowly by identifying which functions consume the most CPU time.
Optimize application code by visualizing which code paths are worth improving based on actual CPU usage.
Compare performance across different versions or configurations by generating flame graphs for each.
Investigate performance regressions by examining stack traces in an interactive, searchable format.
Requires Linux perf, DTrace, or SystemTap installed; Perl interpreter; may need kernel headers or elevated privileges for profiling.
FlameGraph is a tool that turns raw performance profiling data into a visual chart, called a flame graph, that makes it instantly clear where a program is spending most of its time. The problem it solves is performance diagnosis: when a program is slow, developers need to know which function calls are eating CPU time, but raw profiler output is a wall of numbers that is very hard to read. A flame graph stacks those function calls visually so that the widest boxes at the top are the biggest time consumers. The process has three steps. First, you capture stack samples from your running program using a profiler like Linux perf, DTrace, or SystemTap, tools that periodically snapshot what the CPU is doing. Second, a "stackcollapse" script reformats those raw samples into a tidy text format. Third, the main flamegraph.pl script takes that text and renders an interactive SVG image you can open in a browser, zoom into by clicking, and search with Ctrl-F to find specific functions. You would reach for this tool when a production service is slow and you need to find the root cause quickly, or when optimizing code and you want proof of which areas are worth improving. It supports profiling data from Linux perf, DTrace, SystemTap, Java, Go, Instruments, VTune, and more. The core script is written in Perl.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.