Measure Performance Counters With perf stat
See cycles, instructions, cache misses and context switches for one run.
01Command
$ perf stat -d ./my-program02What it does
perf stat reads hardware performance counters around a command, revealing whether a workload is CPU-bound, cache-thrashing or stalling. That low-level visibility is only practical from the command line and is why profiling lives in the terminal.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- perf-stat.1.en.html manual page (Debian bookworm)Evidence: Documents perf stat and the hardware counters it reports.
Last verified: 2026-10-13 · Category: System & Settings
06Related solutions
Launch an interactive process viewer with color meters for CPU cores, memory, and swap, plus search, sort, and kill controls.
Show every TCP and UDP socket in listening state with the owning process name and PID — the modern replacement for netstat.
Show every systemd unit currently in a failed state, so you can inspect and restart whatever broke.