What Are Flame Graphs and How To Read Them

5a5fcbae333f071dc7a28f4958509db5?s=47 Miha Rekar
December 22, 2014

What Are Flame Graphs and How To Read Them

Short tech talk I did for my coworkers on flame graphs.

Further read:
- Blazing Performance with Flame Graphs (video): https://www.usenix.org/conference/lisa13/technical-sessions/plenary/gregg
- FlameGraph: https://github.com/brendangregg/FlameGraph
- ruby-prof: https://github.com/ruby-prof/ruby-prof
- ruby-prof-flamegraph: https://github.com/oozou/ruby-prof-flamegraph

5a5fcbae333f071dc7a28f4958509db5?s=128

Miha Rekar

December 22, 2014
Tweet

Transcript

  1. 2.

    DEFINITION • each box represents a function (a merged stack

    frame) • y-axis shows stack depth • top function led directly to the profiling event • everything beneath it is ancestry (explains why) • x-axis spans the sample population, sorted alphabetically • box width is proportional to the total time a function was profiled directly or its children were profiled • all threads can be shown in the same Flame Graph (the default), or as separate per-thread Flame Graphs • flame graphs can be interactive: mouse over for details
  2. 3.

    LOOKS • Flame Graphs sort stacks alphabetically • from the

    bottom frame upwards • increases merging and visualizes code paths
  3. 7.

    EXAMPLE A: a() → b() → c() → e() →

    f() f() was called by e(), e() was called by c(),…
  4. 11.

    EXAMPLE A: code path branches can reveal key functions:
 a()

    choose the b() path
 c() choose the e() path look for branches