HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

perf — Framework for Linux performance counter measurements. More information: <https://perfwiki.github.io/

Submitted by: @import:tldr-pages··
0
Viewed 0 times
countercommandframeworkperfclilinuxperformancefor
linux

Problem

How to use the perf command: Framework for Linux performance counter measurements. More information: <https://perfwiki.github.io/main/>.

Solution

perf — Framework for Linux performance counter measurements. More information: <https://perfwiki.github.io/main/>.

Display basic performance counter stats for a command:
perf stat {{gcc hello.c}}


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


Run a command and record its profile into perf.data:
sudo perf record {{command}}


Record the profile of an existing process into perf.data:
sudo perf record {{[-p|--pid]}} {{pid}}


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

Code Snippets

Display basic performance counter stats for a command

perf stat {{gcc hello.c}}

Display system-wide real-time performance counter profile

sudo perf top

Run a command and record its profile into `perf.data`

sudo perf record {{command}}

Record the profile of an existing process into `perf.data`

sudo perf record {{[-p|--pid]}} {{pid}}

Read `perf.data` (created by `perf record`) and display the profile

sudo perf report

Context

tldr-pages: linux/perf

Revisions (0)

No revisions yet.