CPU Measurement Facility (CPUMF) for Linux on zSystems

The CPU Measurement Facility (CPUMF) provides hardware data to operating systems running in a LPAR on IBM zSystems. Besides trouble shooting it can also be used for long term analysis.


Before you can collect data, you need to allow the LPAR in the activation profile to read the counters. Enable all four counter sets:

From Linux you then can check if the activation worked by issuing

# lscpumf -i
CPU-measurement Counter Facility
Version: 3.7
Authorized counter sets:
Basic counter Set
Crypto-Activity counter Set
Extended counter Set
MT-diagnostic counter Set
Problem-State counter Set
Linux perf event support: Yes (PMU: cpum_cf)


Long term data collection

All newer Linux distributions support the long term data collection with the new lshwc command. Make sure that you have at least s390-tools at level 2.24. To use it e.g. if you create a cpumf directory under /var/log then with

lshwc --all --interval 60 --loop 1440 > /var/log/cpumf/cpumf_`date +"%d"` 

collects the data every 60s for a total of 1440 repetitions, which translates to 24h for every minute. If you then add that line to the daily cron jobs then you keep a history of one month worth of data. Of course you can use logrotate or your favorite automation framework to compress and store away. Then generated files are in CSV format. You can post process them with your favorite tool.

Be aware that only one program is allowed to access the facility at a time. If you want to run cpacfstats (which collects some of the crypto counters only) or doing perf experiments you have to disable the collection. And if you have a regular collection of hardware counters with either of those tools running, consider replacing it by lshwc.

Further reading

(updated 10/04/2023)



Leave a Comment

Your email address will not be published. Required fields are marked *