PERF-STAT(1) perf Manual PERF-STAT(1) (NAME) perf-stat - (SYNOPSIS) perf stat [-e | --event=EVENT] [-a] perf stat [-e | --event=EVENT] [-a] -- [] perf stat [-e | --event=EVENT] [-a] record [-o file] -- [] perf stat report [-i file] (DESCRIPTION) . (OPTIONS) ... . record STAT RECORD . report STAT REPORT . -e, --event= PMU. : o ( perf list ) o PMU rN N /sys/bus/event_source/devices/cpu/format/* . o PMU cpu-cycles:p. perf-list(1) . o pmu/param1=0x3,param2/ param1 param2 PMU /sys/bus/event_source/devices//format/* 'percore' . : perf stat -A -a -e cpu/event,percore=1/,otherevent ... o pmu/config=M,config1=N,config2=K/ M N K ( ) . config config1 config2 /sys/bus/event_source/devices//format/* glob PMU PMU ( PMU ) . PMU PMU uncore 'uncore_' . -i, --no-inherit -p, --pid= ( ) -t, --tid= ( ) -b, --bpf-prog bpf ( ) (root). bpftool-prog bpf . : # bpftool prog | head -n 1 17247: tracepoint name sys_enter tag 192d548b9d754067 gpl # perf stat -e cycles,instructions --bpf-prog 17247 --timeout 1000 Performance counter stats for 'BPF program(s) 17247': 85,967 cycles 28,982 instructions # 0.34 insn per cycle 1.102235068 seconds time elapsed --bpf-counters BPF perf_events. perf-stat ( cycles instructions ) . BPF <>> . --bpf-attr-map <<--bpf-counters>> perf-stat BPF hashmap . <<--bpf-attr-map>> hashmap . /sys/fs/bpf/perf_attr_map . --pfm-events events PMU libpfm4 ( http://perfmon2.sf.net) . --pfm-events inst_retired:any_p:u:c=1:i. . . -e . -e . {} . -a, --all-cpus CPU ( ) --no-scale / -d, --detailed -d: detailed events, L1 and LLC data cache -d -d: more detailed events, dTLB and iTLB events -d -d -d: very detailed events, adding prefetch events -r, --repeat= + (: ). 0 . -B, --big-num (locale). . <<--no-big-num>> . <> . -C, --cpu= CPU . CPU : 0,1. CPU - : 0-2. per-thread . -a . CPU . -A, --no-aggr CPU . -n, --null (null run) - . (wall-clock time) - perf stat . -v, --verbose ( ) -x SEP, --field-separator SEP CSV . SEP . --table ( -r) : $ perf stat --null -r 5 --table perf bench sched pipe Performance counter stats for 'perf bench sched pipe' (5 runs): # Table of individual measurements: 5.189 (-0.293) # 5.189 (-0.294) # 5.186 (-0.296) # 5.663 (+0.181) ## 6.186 (+0.703) #### # Final result: 5.483 +- 0.198 seconds time elapsed ( +- 3.62% ) -G name, --cgroup name (cgroup) "name" . per-cpu . cgroup (mounted) . "name" CPU . cgroup . cgroup cgroup cgroup . cgroup ( ) -G foo,,bar . cgroup . cgroup -e e1 -e e2 -G foo,foo -e e1 -e e2 -G foo . cycles cgroup : perf stat -e cycles -G cgroup_name -a -e cycles. --for-each-cgroup name cgroup "name" ( cgroup ). regex . -e -G cgroup . -G/--cgroup . -o file, --output file . --append -o. -o . --log-fd fd stderr. --output . --append . : 3>results perf stat --log-fd 3 -- $cmd 3>>results perf stat --log-fd 3 --append -- $cmd --control=fifo:ctl-fifo[,ack-fifo], --control=fd:ctl-fd[,ack-fd] ctl-fifo / ack-fifo ctl-fd / ack-fd . ctl-fd (enable: disable: ). --delay=-1 . (ack\n) ack-fd . bash : #!/bin/bash ctl_dir=/tmp/ ctl_fifo=${ctl_dir}perf_ctl.fifo test -p ${ctl_fifo} && unlink ${ctl_fifo} mkfifo ${ctl_fifo} exec {ctl_fd}<>${ctl_fifo} ctl_ack_fifo=${ctl_dir}perf_ctl_ack.fifo test -p ${ctl_ack_fifo} && unlink ${ctl_ack_fifo} mkfifo ${ctl_ack_fifo} exec {ctl_fd_ack}<>${ctl_ack_fifo} perf stat -D -1 -e cpu-cycles -a -I 1000 \ --control fd:${ctl_fd},${ctl_fd_ack} \ \-- sleep 30 & perf_pid=$! sleep 5 && echo 'enable' >&${ctl_fd} && read -u ${ctl_fd_ack} e1 && echo "enabled(${e1})" sleep 10 && echo 'disable' >&${ctl_fd} && read -u ${ctl_fd_ack} d1 && echo "disabled(${d1})" exec {ctl_fd_ack}>&- unlink ${ctl_ack_fifo} exec {ctl_fd}>&- unlink ${ctl_fifo} wait -n ${perf_pid} exit $? --pre, --post (hooks) : perf stat --repeat 10 --null --sync --pre make -s O=defconfig-build/clean -- make -s -j64 O=defconfig-build/ bzImage -I msecs, --interval-print msecs (count deltas) N (: ). (overhead) . . : perf stat -I 1000 -e cycles -a sleep 5 (metric) # . --interval-count times . <<-I>> . : perf stat -I 1000 --interval-count 2 -e cycles -a --interval-clear . --timeout msecs perf stat N (: ). <<-I>> . : perf stat --time 2000 -e cycles -a --metric-only . . . --per-thread . --per-socket (system-wide). . -a --per-socket ( ). (online) . . --per-die (die) (system-wide). (dies) . -a --per-die ( ). die die . . --per-cluster (processor cluster) . . -a --per-cluster ( ). . . /sys/devices/system/cpu/cpuX/topology/cluster_{id, cpus} . --per-cache (cache instance) . . [Ll][1-9][0-9]* . : <<--per-cache=l3>> <<--per-cache=L3>> . --per-core . . -a --per-core ( ). . --per-thread ( -t) ( -p). --per-node NUMA . NUMA . -a --per-node ( ). -D msecs, --delay msecs msecs (-1: ). . -T, --transaction . --metric-no-group (weak groups) . << >> . --metric-no-group . (instructions per cycle) . --metric-no-merge . (event multiplexing) . . . --metric-no-threshold . (multiplexing) . . . --quiet . perf stat record perf.data . --no-affinity (CPUs) (scheduler CPU affinities) . (interprocessor interrupts) . (STAT RECORD) stat perf . -o file, --output file . (STAT REPORT) stat perf . -i file, --input file . --per-socket . --per-die (die) . --per-cluster . --per-cache . . [Ll][1-9][0-9]* . : <<--per-cache=l3>> <<--per-cache=L3>> . --per-core . -M, --metrics . . . perf list . . . -A, --no-aggr, --no-merge (CPUs) PMU / . stat . . : 1. PID CPU . SMT . 2. (glob wildcard) PMU . PMU 0_ 1_ . PMU ( uncore_imc uncore_imc_0) . 3. (Aliases) Kernel PMU perf list . --hybrid-merge PMU . (hybrid) big.LITTLE PMU . PMU CPU . --topdown (top-down) CPU . frontend bound backend bound bad speculation retiring (pipeline) (CPU bound) . Frontend bound CPU (fetch) (decode) . Backend bound . Bad Speculation (branch mispredictions) . Retiring . CPU . -I 1000 . --metric-only --no-metric-only . Intel Atom (IceLake ) TopDown (thread) : . per core -a ( ) (root) perf.perf_event_paranoid=-1 . Topdown Performance Monitoring Unit NMI watchdog ( ) : echo 0 > /proc/sys/kernel/nmi_watchdog. . CPU . taskset . --record-tpebs retire_latency Intel TPEBS ( :R) . perf retire_latency . retire_latency . TPEBS Intel Granite Rapids . X86_64 Intel TPEBS . --tpebs-mode=[mean|min|max|last] (retirement latency) . "mean" . "min" "max" . "last" . --td-level (top-down) . . . _group . tma_frontend_bound . tma_frontend_bound_group perf stat -M tma_frontend_bound_group... . . --smi-cost msr/aperf/ msr/smi/ SMI . /sys/device/cpu/freeze_on_smi (freeze) SMI . aperf . SMI (aperf - unhalted core cycles) . SMI . --metric_only . SMI : (aperf - unhalted core cycles) / aperf --no-metric-only . --all-kernel (kernel space). --all-user (user space). --percore-show-thread "percore" . "percore" . any . --summary (-I) . --no-csv-summary summary CSV . -x --summary . perf stat.no-csv-summary . $ perf config stat.no-csv-summary=true --cputype (hybrid) ( core atom)" --pmu-filter PMU PMU ( hisi_sicl2_cpa0 hisi_sicl0_cpa0) (EXAMPLES) $ perf stat -- make Performance counter stats for 'make': 83723.452481 task-clock:u (msec) # 1.004 CPUs utilized 0 context-switches:u # 0.000 K/sec 0 cpu-migrations:u # 0.000 K/sec 3,228,188 page-faults:u # 0.039 M/sec 229,570,665,834 cycles:u # 2.742 GHz 313,163,853,778 instructions:u # 1.36 insn per cycle 69,704,684,856 branches:u # 832.559 M/sec 2,078,861,393 branch-misses:u # 2.98% of all branches 83.409183620 seconds time elapsed 74.684747000 seconds user 8.739217000 seconds sys . / : 83.409183620 seconds time elapsed / : 74.684747000 seconds user 8.739217000 seconds sys time . CSV (CSV FORMAT) -x perf stat CSV "" . -x \; . : o (usec) ( -I xxx) o CPU o CPU o o o o o o -r o (metric) o ..SH " (INTEL HYBRID SUPPORT)" perf. AlderLake atom core . . core atom . PMU sysfs : /sys/bus/event_source/devices/cpu_core /sys/bus/event_source/devices/cpu_atom cpus . cat /sys/bus/event_source/devices/cpu_core/cpus 0-15 cat /sys/bus/event_source/devices/cpu_atom/cpus 16-23 cpu0-cpu15 core cpu16-cpu23 atom . perf-list . perf list inst_retired.any [Fixed Counter: Counts the number of instructions retired. Unit: cpu_atom] inst_retired.any [Number of instructions retired. Fixed Counter - architectural event. Unit: cpu_core] Unit: xxx PMU . PMU . PMU core atom : cpu_core// or cpu_atom// cycles core. perf stat -e cpu_core/cycles/ atom core . atom core. cache cpu_core cpu_atom . ( 0 cycles). ( atom core). perf PERF_TYPE_HARDWARE PMU . PMU . PMU attr.config[63:32] . PMU sysfs . /sys/bus/event_source/devices/cpu_atom/type /sys/bus/event_source/devices/cpu_core/type attr.config PERF_TYPE_HARDWARE: PERF_TYPE_HARDWARE: 0xEEEEEEEE000000AA AA: EEEEEEEE: PMU cache . PERF_TYPE_HW_CACHE PMU . PMU attr.config[63:32] . attr.config PERF_TYPE_HW_CACHE: PERF_TYPE_HW_CACHE: 0xEEEEEEEE00DDCCBB BB: cache CC: cache DD: cache EEEEEEEE: PMU PMU perf stat -e cycles -a ( ) . ------------------------------------------------------------ perf_event_attr: size 120 config 0x400000000 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 exclude_guest 1 ------------------------------------------------------------ ------------------------------------------------------------ perf_event_attr: size 120 config 0x800000000 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 exclude_guest 1 ------------------------------------------------------------ 0 PERF_TYPE_HARDWARE . 0x4 0x400000000 PMU cpu_core . 0x8 0x800000000 PMU cpu_atom ( PMU atom ). cycles (0x400000000) cpu0-cpu15 ( core) cycles (0x800000000) cpu16-cpu23 ( atom) . perf-stat : Performance counter stats for 'system wide': 6,744,979 cpu_core/cycles/ 1,965,552 cpu_atom/cycles/ cycles core cycles atom . (Thread mode): perf-stat . (running time/enabling time). triad_loop cpu16 ( atom) core 160,444,092 0.47% . perf stat -e cycles -- taskset -c 16 ./triad_loop . .ft C perf_event_attr: size 120 config 0x400000000 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 enable_on_exec 1 exclude_guest 1 .ft .ft C perf_event_attr: size 120 config 0x800000000 sample_type IDENTIFIER read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING disabled 1 inherit 1 enable_on_exec 1 exclude_guest 1 .ft Performance counter stats for 'taskset -c 16 ./triad_loop': 233,066,666 cpu_core/cycles/ (0.43%) 604,097,080 cpu_atom/cycles/ (99.57%) perf-record: -e perf record cycles . core atom. perf-stat: -e perf stat . cpu_core/cycles/, cpu_atom/cycles/, cpu_core/instructions/, cpu_atom/instructions/, cpu_core/branches/, cpu_atom/branches/, cpu_core/branch-misses/, cpu_atom/branch-misses/ perf-stat perf-record PMU . : perf stat -e cpu_core/cycles/ perf stat -e cpu_atom/cycles/ perf stat -e cpu_core/r1a/ perf stat -e cpu_atom/L1-icache-loads/ perf stat -e cpu_core/cycles/,cpu_atom/instructions/ perf stat -e {cpu_core/cycles/,cpu_core/instructions/} {cpu_core/cycles/,cpu_atom/instructions/} PMU (cpu_core cpu_atom)..SH " JSON (JSON FORMAT)" -j perf stat JSON . o interval : ( -I) o : o core : ( --per-core) o die : die ( --per-die) o socket : ( --per-socket) o node : ( --per-node) o thread : ( --per-thread) o counters : PMU o counter-value : o unit : o event : o variance : ( -r) o event-runtime : o pcnt-running : o metric-value : o metric-unit : perf-top(1), perf-list(1) perf 09/04/2026 PERF-STAT(1)