5.4. Performance Counters for Linux (PCL) Tools and perf
Performance Counters for Linux (PCL) is a new kernel-based subsystem that provides a framework for collecting and analyzing performance data. These events will vary based on the performance monitoring hardware and the software configuration of the system. Red Hat Enterprise Linux 6 includes this kernel subsystem to collect data and the user-space tool
perf to analyze the collected performance data.
The PCL subsystem can be used to measure hardware events, including retired instructions and processor clock cycles. It can also measure software events, including major page faults and context switches. For example, PCL counters can compute the Instructions Per Clock (IPC) from a process's counts of instructions retired and processor clock cycles. A low IPC ratio indicates the code makes poor use of the CPU. Other hardware events can also be used to diagnose poor CPU performance.
Performance counters can also be configured to record samples. The relative frequency of samples can be used to identify which regions of code have the greatest impact on performance.
5.4.1. Perf Tool Commands
perf commands include the following:
- perf stat
perfcommand provides overall statistics for common performance events, including instructions executed and clock cycles consumed. Options allow selection of events other than the default measurement events.
- perf record
perfcommand records performance data into a file which can be later analyzed using
- perf report
perfcommand reads the performance data from a file and analyzes the recorded data.
- perf list
perfcommand lists the events available on a particular machine. These events will vary based on the performance monitoring hardware and the software configuration of the system.
perf help to obtain a complete list of
perf commands. To retrieve
man page information on each
perf command, use
perf help command.