explaingit

brendangregg/flamegraph

19,483PerlAudience · developerComplexity · 2/5StaleLicenseSetup · moderate

TLDR

Converts raw profiling data into interactive visual charts that show exactly which functions are consuming CPU time, making performance bottlenecks instantly obvious.

Mindmap

mindmap
  root((repo))
    What it does
      Visualizes CPU usage
      Shows function hotspots
      Interactive SVG charts
    How it works
      Capture stack samples
      Reformat with stackcollapse
      Render with flamegraph.pl
    Use cases
      Debug slow services
      Optimize code
      Find bottlenecks
    Tech stack
      Perl
      Linux perf
      DTrace
    Supported profilers
      SystemTap
      Java profilers
      Go pprof
      VTune

Things people build with this

USE CASE 1

Diagnose why a production service is running slowly by identifying which functions consume the most CPU time.

USE CASE 2

Optimize application code by visualizing which code paths are worth improving based on actual CPU usage.

USE CASE 3

Compare performance across different versions or configurations by generating flame graphs for each.

USE CASE 4

Investigate performance regressions by examining stack traces in an interactive, searchable format.

Tech stack

PerlLinux perfDTraceSystemTapSVG

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Linux perf, DTrace, or SystemTap installed; Perl interpreter; may need kernel headers or elevated privileges for profiling.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

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.

Copy-paste prompts

Prompt 1
I have Linux perf output from a slow application. How do I use flamegraph to convert it into a visual chart I can click through?
Prompt 2
Show me how to capture stack samples from a running process and generate a flame graph to find CPU bottlenecks.
Prompt 3
I'm profiling a Java application. What's the workflow to create a flame graph from Java profiler output using this tool?
Prompt 4
How do I search for a specific function name in a flame graph SVG to see how much CPU time it's using?
Prompt 5
What profilers does flamegraph support, and how do I format their output for visualization?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.