How to install and use Perf performance analysis tool on CentOS 8

How to install and use Perf performance analysis tool on CentOS 8

Perf is a performance analysis tool in the Linux operating system. It comes with many sub-commands and can perform statistical analysis on the entire system. It supports tracking points, software performance counters, hardware performance counters and dynamic probes. It can also help you solve advanced performance and troubleshooting features.

In this tutorial, we will show you how to install and use perf performance analysis tool on CentOS 8.

prerequisites

  • Server running CentOS 8.
  • The root password is set on your server.

Installation performance

By default, the Perf package is available in the CentOS 8 default repository. You can install it by simply running the following command:

dnf install perf -y

After installation, you can use the following command to list all the subcommands available for Perf:

perf --help

You should see the following screen:

Performance statistics

This subcommand runs commands and collects Linux performance statistics from it.

You can use the following command to display a list of software predefined events in Linux:

perf list stat

You should see the following screen:

Performance statistics

If you want to know what happens in the system when we run the “free -m” command, please use the following command:

perf stat free -m

You should check the performance statistics of the free -m command on the following screen:

No performance statistics

Performance top

perf-top is a system configuration tool used to generate and display performance counter configuration files in real time.

You can use perf top with the -a option to view all known event types:

perf top -a

You should see the following screen:

Highest performance commands

You can also use the -e option to display events related to the CPU clock:

perf top -e cpu-clock

You should see the following screen:

Performance processorad

Performance record

perf-record runs the command and records its summary to perf.data in the current working directory

For example, run the command “df -h” and use the following command to record its profile to perf.data:

perf record df -h

You should see the following screen:

Performance record

Performance report

This command will analyze the file generated by the performance record and generate a flat or graphical outline.

perf report

You should see the following screen:

Performance report

in conclusion

In the above guide, we learned how to install and use Perf performance monitoring tool on CentOS 8 system. I hope you now have enough understanding of how to use performance to obtain system performance data. For more information, please visit Performance documentation page.

Sidebar