Forrest logo
tool overview
On this page you find all important commands for the CLI tool perf. If the command you are looking for is missing please ask our AI.

perf

Perf stands for "performance" and is a powerful command line tool for analyzing and profiling the performance of a Linux system. It is a part of the Linux kernel and is available on most Linux distributions. Perf enables developers and system administrators to gather detailed information about various aspects of system performance.

With Perf, users can collect data about CPU usage, cache misses, context switches, and other system events. It provides a wide range of features such as sampling, tracing, and profiling, making it a versatile tool for performance analysis. Perf can be used to investigate application bottlenecks, identify performance issues, and optimize system performance.

One of the key features of Perf is its ability to generate reports and visualizations using the collected data. It can generate text-based reports or export data to visualize with tools like Graphviz, FlameGraphs, or Perf-UI. This makes it easier to analyze and understand the performance characteristics of a system.

Perf supports various profiling modes, including CPU profiling, memory profiling, and event-based profiling. It can also be used for hardware event sampling, enabling users to track events such as cache misses, instructions retired, or page faults.

Moreover, Perf has a user-friendly command line interface with various options and parameters, allowing users to customize their profiling and analysis sessions. It is a valuable tool for performance engineering, debugging, and optimizing Linux systems.

List of commands for perf:

  • perf:tldr:1cad9 perf: Record the profile of an existing process into `perf.data`.
    $ sudo perf record -p ${pid}
    try on your machine
    explain this command
  • perf:tldr:3bb38 perf: Read `perf.data` (created by `perf record`) and display the profile.
    $ sudo perf report
    try on your machine
    explain this command
  • perf:tldr:590b1 perf: Display system-wide real-time performance counter profile.
    $ sudo perf top
    try on your machine
    explain this command
  • perf:tldr:755f7 perf: Display basic performance counter stats for a command.
    $ perf stat ${gcc hello-c}
    try on your machine
    explain this command
  • perf:tldr:d5e06 perf: Run a command and record its profile into `perf.data`.
    $ sudo perf record ${command}
    try on your machine
    explain this command
tool overview