LinuxCommandLibrary

perf

performance analysis tools for Linux

TLDR

Display basic performance counter stats for a command

$ perf stat [gcc hello.c]
copy


Display system-wide real-time performance counter profile
$ sudo perf top
copy


Run a command and record its profile into perf.data
$ sudo perf record [command]
copy


Record the profile of an existing process into perf.data
$ sudo perf record -p [pid]
copy


Read perf.data (created by perf record) and display the profile
$ sudo perf report
copy

SYNOPSIS

perf [--version] [--help] COMMAND [ARGS]

DESCRIPTION

Performance counters for Linux are are a new kernel-based subsystem that provide a framework for all things performance analysis. It cov‐ ers hardware level (CPU/PMU, Performance Monitoring Unit) features and software features (software counters, tracepoints) as well. Each version of the perf tools may depend on new kernel features, so you must install a different version for each kernel version. The perf command will automatically run the correct version for the running ker‐ nel version.

SEE ALSO

perf_version(1) 4 July 2010 PERF(1)

Copied to clipboard