Linux /proc and Process Debugging/Record perf samples for PID

Collect CPU samples for one PID over time.

Section: Tracing System Calls and Libraries

Record perf samples for PID

bash
bash
sudo perf record -p 1234 -- sleep 30
Explanation

Collect CPU samples for one PID over time.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Tracing System Calls and Libraries
Profile hot code paths
Sample hot functions on the system in real time.
OpenIn sheetbashsame section
Inspect recorded samples
Analyze a perf recording interactively.
OpenIn sheetbashsame section
Trace a command with strace
Trace syscalls made by a new command.
OpenIn sheetbashsame section
Attach strace to a running PID
Attach to a live process and trace syscalls.
OpenIn sheetbashsame section
Trace child processes too
Write one trace file per process and follow forks.
OpenIn sheetbashsame section
Trace network syscalls
Focus on network-related system calls only.
OpenIn sheetbashsame section