brendangregg / FlameGraph
git clone https://github.com/brendangregg/FlameGraph.git
v1.0 · 9y ago
🔥 on GitHub Trending today
Perl scripts that turn folded profiler stack samples into interactive SVG flame graphs.
Why you might care
Standard toolkit for visualizing CPU, memory, and other profiling stacks from perf, DTrace, SystemTap, and similar profilers. Works in three steps: capture stacks, fold them with stackcollapse scripts, then render with flamegraph.pl into a clickable, searchable SVG.
+2
stars, 24h · #9,847
+~5
stars, 7 days · #17,333
+58
stars, 30 days · #11,483
20k
★ total · +0% this week
2.1k
forks · 121 open issues
Star history (as recorded here)
LanguagePerl
License—
Created2011-12-16 (14y ago)
Last push2y ago
Watchers476
OwnerUser
Seen on GitHub Trending
- 2026-10-23 — #7 monthly in perl · +57 ★
- 2026-10-22 — #7 monthly in perl · +58 ★
- 2026-10-21 — #6 daily in perl · +4 ★
- 2026-10-21 — #7 monthly in perl · +60 ★
- 2026-10-20 — #6 daily in perl · +4 ★
- 2026-10-20 — #7 monthly in perl · +58 ★
Links
- GitHub: github.com/brendangregg/FlameGraph
- Homepage: http://www.brendangregg.com/flamegraphs.html
- Releases · Issues · Hacker News mentions
README excerpt
# Flame Graphs visualize profiled code Main Website: http://www.brendangregg.com/flamegraphs.html Example (click to zoom): Click a box to zoom the Flame Graph to this stack frame only. To search and highlight all stack frames matching a regular expression, click the _search_ button in the upper right corner or press Ctrl-F. By default, search is case sensitive, but this can be toggled by pressing Ctrl-I or by clicking the _ic_ button in the upper right corner. Other sites: - The Flame Graph article in ACMQ and CACM: http://queue.acm.org/detail.cfm?id=2927301 http://cacm.acm.org/magazines/2016/6/202665-the-flame-graph/abstract - CPU profiling using Linux perf\_events, DTrace, SystemTap, or ktap: http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html - CPU profiling using XCode Instruments: http://schani.wordpress.com/2012/11/16/flame-graphs-for-instruments/ - CPU profiling using Xperf.exe: http://randomascii.wordpress.com/2013/03/26/summarizing-xperf-cpu-usage-with-flame-graphs/ - Memory profiling: http://www.brendangregg.com/FlameGraphs/memoryflamegraphs.html - Other examples, updates, and news: http://www.brendangregg.com/flamegraphs.html#Updates Flame graphs can be created in three steps: 1. Capture stacks 2. Fold stacks 3. flamegraph.pl 1\. Capture stacks ================= Stack samples can be captured using Linux perf\_events, FreeBSD pmcstat (hwpmc), DTrace, SystemTap, and many other profilers. See the stackcollapse-\* converters. ### Linux perf\_events Using Linux perf\_events (aka "perf") to capture 60 seconds of 99 Hertz stack samples, both user- and kernel-level stacks, all processes: [code] Now only capturing PID 181: [code] ### DTrace Using DTrace to capture 60 seconds of kernel stacks at 997 Hertz: [code] Using DTrace to capture 60 seconds of user-level stacks for PID 12345 at 97 Hertz: [code] 60 seconds of user-level stacks, including time spent in-kernel, for PID 12345 at 97 Hertz: [code] Switch `ustack()` for `jstack()` if the application has a ustack helper to include translated frames (eg, node.js frames; see: http://dtrace.org/blogs/dap/2012/01/05/where-does-your-node-program-spend-its-time/). The rate for user-level stack collection is deliberately slower than kernel, which is especially important when using `jstack()` as it performs additional work to translate frames. 2\. Fold stacks ============== Use the stackcollapse programs to fold stack samples into single lines. The programs provided are: - `stackcollapse.pl`: for DTrace stacks - `stackcollapse-perf.pl`: for Linux perf_events "perf script" output - `stackcollapse-pmc.pl`: for FreeBSD pmcstat -G stacks - `stackcollapse-stap.pl`: for SystemTap stacks - `stackcollapse-instruments.pl`: for XCode Instruments - `stackcollapse-vtune.pl`: for Intel VTune profiles - `stackcollapse-ljp.awk`: for Lightweight Java Profiler - `stackcollapse-jstack.pl`: for Java jstack(1) output - `stackcollapse-gdb.pl`: for gdb(1) stacks - `stackcollapse-go.pl`: for Golang pprof s
Blurb generated by claude-haiku-5-5 today. Star deltas marked ~ are extrapolated from partial history.