Linux perf events reference
The perf tool reads CPU performance counters and kernel statistics to profile programs. Each measurement is named by an event: a symbol like cycles, cache-misses, or sched:sched_switch that you pass to perf stat or perf record. This reference lists the common events, the category they belong to, and what each one actually measures.
Filter the list by name or category to find the right symbol, then run perf stat -e EVENT ./yourprogram to count it.
How it works
Hardware events come from the CPU’s Performance Monitoring Unit (PMU), a small set of programmable counters that increment on micro-architectural occurrences such as retired instructions or last-level-cache misses. Because there are only a handful of physical counters, requesting many events forces the kernel to multiplex them in time and scale the results.
Software events are bookkeeping counters the kernel maintains directly — context switches, page faults, CPU migrations — so they are exact and unlimited. Cache events use a generic encoding of {L1D, LLC, ...} x {load, store} x {access, miss}. Tracepoints are static instrumentation points in kernel subsystems (block:, sched:, syscalls:) that fire on specific events. Symbolic names map to raw PMU codes; you can also specify a raw event with r<hex>.
Tips and examples
Measure IPC and cache behavior for a command:
perf stat -e cycles,instructions,cache-references,cache-misses ./app
Sample where cache misses happen and view by function:
perf record -e cache-misses -g ./app
perf report
Counting is low-overhead; sampling (record) is higher overhead but shows where. Use perf list to confirm which events your specific CPU supports — names vary across microarchitectures, and PMU-specific events appear as cpu/event=.../.