Show a live CPU call graph

Live view of hot functions with their callers; dwarf unwinding works without frame pointers

perf top -g --call-graph dwarf

tool
perf17 commands
tags
perfperformancedebugtroubleshooting

More perf commands

  • perf record -F 99 -a -g -- sleep 30 && perf report --stdio

    Sample the whole machine at 99 Hz for 30 seconds and print a text report; 99 Hz avoids sampling in lockstep with timers

  • perf script | stackcollapse-perf.pl | flamegraph.pl > flame.svg

    Turn perf.data into an interactive flame graph SVG with Brendan Gregg's FlameGraph tools

  • perf stat -d -d -d -- ./app

    Three -d flags add L1, LLC, TLB and stalled-cycle details, so you can see if the app waits on memory or on CPU

  • perf sched record -- sleep 10 && perf sched latency --sort max

    Record context switches and show wakeup latency per task to find tasks waiting too long in the run queue

  • perf trace -s -p <pid>

    Trace syscalls like strace and print a summary with -s; lower overhead because it does not use ptrace

all 17 perf commands