lshwc - Extract CPU Measurement Facilities counter sets
![]()
Use the lshwc command to extract complete counter sets from the CPU Measurement Facilities for Linux® on IBM® Z.
The command output is in comma-separated values (CSV) format. Each output line starts with a timestamp and the CPU number, followed by the extracted counter values.
lshwc syntax
- -a or --allcpu
- Displays counter values separately for each CPU. The default is a total summary line of all counters from all CPUs.
- -c or --counters
- Specify a comma-separated list of counter names to be printed. If a counter name does not match any valid counter name, it is omitted. (Implies -H)
- -d or --delta
- Displays counter values in the form of deltas. Each counter value shows the increment to the previous output line. Without this flag the total value of each counter is displayed.
- -i or --interval <seconds>
- Specifies a time interval, in seconds, that the command waits between read operations. The default is 60 seconds.
- -l or --loop <count>
- Performs the specified number of read operations.
- -H or --hide
- Do not display values of undefined counters.
- -s or --short
- Displays counter names as short names in the heading. A short name consists of a letter for the
counter set followed by a number. For example, this flag displays counter number 0 in the basic
counter set as
B0instead ofCycles. Valid counter set letters are:B- Basic counter set.P- Problem state counter set.C- Crypto counter set.E- Extended counter setM- MT-diagnostic counter set.U- Undefined counter.
- -t or --time
- Specifies the runtime as an integer in days, hours, minutes or seconds. This option can be
specified multiple times: the runtime sums up. Specify time as an integer followed by one of the letters
d- Specifies the runtime in days.h- Specifies the runtime in hours.m- Specifies the runtime in minutes.s- Specifies the runtime in seconds. This is the default.
- -x or --hex
- Displays counter values as hexadecimal values.
- -X or --hex0x
- Displays counter values as hexadecimal values with a leading
0xprefix. - -q
- Apply quoting to every output element, regardless of content or format.
- -f or --format
- Retrieve output in one of the following formats: JSON, CSV, JSON-SEQ or PAIRS. If no format is specified, the output defaults to CSV.
- <cpu>
- The number of a logical CPU.
- <from_cpu>-<to_cpu>
- A range of CPUs, where <from_cpu> is the number of the first logical CPU in the range and <to_cpu> is the number of the last logical CPU in the range. Ranges are useful if you want to extract the same counter sets for multiple, consecutive CPU numbers.
- <sets>
- A specification of counter sets to be extracted for a specified CPU or CPU range. By default,
all available counters are extracted. Use a single alphabetic character to specify a counter set.
You can specify multiple counter sets by specifying a multiple letters without a blank. In the
specification, uppercase letters are equivalent to lowercase letters.
- b|B
- Include the basic counter set.
- c|C
- Include the crypto counter set.
- e|E
- Include the extended counter set.
- m|M
- Include the MT_Diagnostic counter set.
- p|P|u|U
- Include the problem counter set.
- a|A
- Include all known counter sets. This is the default.
Examples
- To select the basic and problem counter sets on CPU 0 and CPU 1 with two read operations
performed and a summary line printed for each read operation, issue:
# lshwc -l2 0-1:BP Date,Time,CPU,CPU_CYCLES(0),INSTRUCTIONS(1),L1I_DIR_WRITES(2),L1I_PENALTY_CYCLES(3), ... 2021-04-01,11:50:32,Total,125422,39421,304,13953,454,97489,0,0 2021-04-01,11:51:32,Total,68074231,16386850,194028,21382384,317227,104503489,777383,14198
- To list the counter values of the problem state counter set per CPU for CPU 0 and CPU 1,
issue:
# lshwc -l 3 -a 0-1:p Date,Time,CPU,PROBLEM_STATE_CPU_CYCLES(32),PROBLEM_STATE_INSTRUCTIONS(33) 2021-04-01,11:54:47,CPU0,0,0 2021-04-01,11:54:47,CPU1,0,0 2021-04-01,11:54:47,Total,0,0 2021-04-01,11:55:47,CPU0,818775,14198 2021-04-01,11:55:47,CPU1,125689,1306 2021-04-01,11:55:47,Total,944464,15504 2021-04-01,11:56:47,CPU0,3207071426,1489122591 2021-04-01,11:56:47,CPU1,3225092021,1489278312 2021-04-01,11:56:47,Total,6432163447,2978400903
- To list the counter values of the basic counter set using delta output format,
issue:
# lshwc -d -l 10 -i 5 -s :b Date,Time,CPU,B0,B1,B2,B3,B4,B5 2025-03-26,10:34:19,Total,208075,117287,1950,50548,1082,49609 2025-03-26,10:34:24,Delta,85800055,70353492,590286,13228290,364034,12945804 2025-03-26,10:34:29,Delta,70654751,60656797,483047,10838672,305703,10570868 2025-03-26,10:34:34,Delta,81043162,69476160,587141,13228161,376662,12868298 2025-03-26,10:34:39,Delta,73434017,62675417,524857,11787256,333966,11543649 2025-03-26,10:34:44,Delta,68367967,58452919,506712,11370740,310785,10589883 2025-03-26,10:34:49,Delta,70351947,57607764,507675,11433377,312433,10676243 2025-03-26,10:34:54,Delta,77154817,65371168,562153,12671030,349750,12311061 2025-03-26,10:34:59,Delta,88871882,75441201,655310,14875963,392530,13773130 2025-03-26,10:35:04,Delta,83763472,71730813,609260,13643680,366992,12672405
- To show the counter values of the problem state counter set with CPU 3 selected in json format,
issue:
# lshwc -l2 -a 3:P -H --format json