Forrest logo
back to the perf tool

perf:tldr:590b1

perf: Display system-wide real-time performance counter profile.
$ sudo perf top
try on your machine

The sudo perf top command is used to monitor and display the CPU performance statistics in real time on a Linux system.

Here's how it works:

  • sudo is the command used to run a program with administrative or superuser privileges. It allows the perf command to access sensitive system information and perform low-level performance monitoring operations.

  • perf is a Linux tool used for performance analysis and profiling of the CPU, memory, and other system resources. It provides detailed insights and statistics about various aspects of system performance.

  • top is a command-line utility that displays a dynamic, real-time view of the most resource-consuming processes on a Linux system. However, when combined with perf, it presents the same information in a more performance-oriented way.

When you run sudo perf top, the command starts monitoring the system's activities, samples the CPU usage at regular intervals, and displays a live, interactive text-based interface showing the top performance-consuming processes. The output of perf top is sorted by CPU utilization, with the most resource-intensive processes listed at the top.

By observing perf top, you can get an overview of which processes are taking up the most CPU time, helping you identify potential performance bottlenecks, analyze code efficiency, or optimize system resource allocation.

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