Forrest logo
back to the perf tool

perf:tldr:1cad9

perf: Record the profile of an existing process into `perf.data`.
$ sudo perf record -p ${pid}
try on your machine

The command sudo perf record -p ${pid} is used to start profiling the performance of a specific running process with the given process ID (${pid}). Here's how the command works:

  • sudo: The sudo command is used to run another command with administrative (root) privileges.

  • perf: It is a performance analysis tool available in Linux systems. It can be used to collect and analyze various performance-related data.

  • record: This subcommand of perf is used to start recording performance events.

  • -p ${pid}: The -p option is used to specify the process ID (${pid}) for which the profiling needs to be done. The ${pid} variable should be replaced with the actual process ID.

By executing this command with the necessary privileges and specifying the process ID, the perf tool will start recording various performance events for the specified process. These events can later be analyzed to identify performance bottlenecks, resource usage, and other performance-related details.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the perf tool