Using the CPU-measurement facilities
Use the CPU-measurement counter facility and sampling facility to obtain performance data for Linux® in LPAR mode.
- Counter facility
- The hardware counters are grouped into the following counter sets:
- Basic counter set
- Problem-state counter set
- Crypto-activity counter set
- Extended counter set
- MT-diagnostic counter set
A further common counter set, the Coprocessor group counter set, cannot be accessed from Linux on IBM® Z.
- Sampling facility
- The sampling facility includes the following sampling modes:
- Basic-sampling mode
- Diagnostic-sampling mode
The number and type of individual counters and the details of the sampling facility depend on your IBM Z hardware model. Use the lscpumf command to find out what is available for your hardware. For details, see IBM The CPU-Measurement Facility Extended Counters Definition for z10, z196/z114, zEC12/zBC12, z13®/z13s®, z14, z15® and z16, SA23-2261.
You can use the perf tool on Linux to access the hardware counters and sample data of the CPU-measurement facilities. To use the perf tool, you need to install the perf tool package, perf-<version>.s390x.rpm, provided with Red Hat® Enterprise Linux.
To access counter data, you can also use the lshwc command, see lshwc - Extract CPU Measurement Facilities counter sets.
If you want to write your own application for analyzing counter or sample data, you can use the
libpfm4
library. This library is available on sourceforge at perfmon2.sourceforge.net.
If you want to write your own application for analyzing counter data, you can also use an API through ioctls, see Obtaining counter data through an API.