Files
cheatsheet-tldr/tldr/linux/perf
2025-11-25 00:19:28 +00:00

30 lines
666 B
Plaintext

---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# 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`