commands

perf — Count selected performance events

Collect selected event counts subject to hardware and kernel policy; do not weaken permissions. Use a fresh private workspace; No production workload is required.

Formal Syntax & Structure

linux syntaxlinux
perf stat -e EVENT -- COMMAND

Parameters & Attributes

NameTypeDescription
statoperandAggregate counts
-eoptionEvent selector
EVENToperandEvent name
COMMANDoperandAuthorized child command

Return Value

exit status and output

The stat operation reports selected performance counters, typically on stderr. Inspect unsupported or permission-denied counters and the workload outcome; successful tool invocation is not evidence that every event was measured.

Working Example

Example Snippetlinux
perf stat -e task-clock -- /bin/true
Linux Reference