Breaking News
Home / How To / How to Install and Use Perf Performance Analysis Tools on CentOS 8

How to Install and Use Perf Performance Analysis Tools on CentOS 8



Perf is a performance analysis tool in Linux operating systems. It comes with a number of sub commands that can statistically profile the entire system. It supports tracepoints, software performance counters, hardware performance counters and dynamic probes. It also helps you solve advanced performance and troubleshooting features.

In this tutorial we will show you how to install and use the analysis tool for perfect performance on CentOS 8.

Prerequisites

  • A server running CentOS 8. [19659005] A root password is set on your server.

Installing Perf

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

  dnf install perf -y 

When the installation is complete, you can list all available subcommands with Perf with the following command:

  perf --help 

see following screen:

  Install Perf

Perf Stat

This subcommand executes a command and collects Linux performance statistics from it.

You can view the list of predefined software events in Linux using the following command:

  perf list stat 

You would see the following screen:

 Perf stat

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

  perf stat free -m 

You should see the performance statistics for the free -m command on the following screen: [19659015]   Perf stat free

Perf Top

perf-top is a system profile tool used to generate and display a real-time performance calculator profile.

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

  perf top -a 

You should see the following screen:

 Perf top command

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

  perf top -e CPU clock 

You should see the following screen:

 Perf cpu

Perf Record

perf-record executes a command and records its profile in perf.data in the current work directory.

For example, run a command "df -h" and record its profile in perf.data with the command below:

  perf record df -h 

You should see the following screen:

 Perf record

Perf Report

This command will analyze file generated by perf record and generate flat or graph profile. Ads

  perf r eport 

You should see the following screen:

 Perf report

Conclusion

In the above guide, we learned how to install and use the Perf performance monitoring tool on the CentOS 8 system. I hope you now have enough knowledge on how to use perf to get performance data for your system. More information can be found on the Perf documentation page.


Source link