mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Add option -s or --short to display the header using a short counter name. With this option the counter symbol names, which can be very long as in IDCW_ON_DRAWER_DRAWER_HIT are replaced by a shorter name. That name consists of an abbrevation for the counter set this counter belongs to and the counter number in that set. The abbrevations are: B --> Basic counter set P --> Problem state counter set C --> Crypto counter set E --> Extended counter set M --> MT_Diagnostic counter set U --> Undefined counter. Display E165 for counter name IDCW_ON_DRAWER_DRAWER_HIT which is counter number 165 from the extended counter set. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
/* Copyright IBM Corp. 2022, 2024
|
|
*
|
|
* s390-tools is free software; you can redistribute it and/or modify
|
|
* it under the terms of the MIT license. See LICENSE for details.
|
|
*/
|
|
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "lib/libcpumf.h"
|
|
|
|
int libcpumf_ctrset(int ctr, int cfvn, int csvn)
|
|
{
|
|
/* Governs basic and problem state counters */
|
|
switch (cfvn) {
|
|
case 1:
|
|
if (ctr >= 0 && ctr < 32)
|
|
return CPUMF_CTRSET_BASIC;
|
|
if (ctr >= 32 && ctr < 38)
|
|
return CPUMF_CTRSET_PROBLEM_STATE;
|
|
break;
|
|
case 3:
|
|
if (ctr >= 0 && ctr < 32)
|
|
return CPUMF_CTRSET_BASIC;
|
|
if (ctr >= 32 && ctr < 34)
|
|
return CPUMF_CTRSET_PROBLEM_STATE;
|
|
break;
|
|
}
|
|
|
|
/* Governs crypto, extended and MT-Diagnositc counters */
|
|
switch (csvn) {
|
|
case 1 ... 5:
|
|
if (ctr >= 64 && ctr < 80)
|
|
return CPUMF_CTRSET_CRYPTO;
|
|
if ((csvn == 1 && ctr >= 128 && ctr < 160) ||
|
|
(csvn == 2 && ctr >= 128 && ctr < 176) ||
|
|
(ctr >= 128 && ctr < 256))
|
|
return CPUMF_CTRSET_EXTENDED;
|
|
break;
|
|
case 6 ... 8:
|
|
if (ctr >= 64 && ctr < 84)
|
|
return CPUMF_CTRSET_CRYPTO;
|
|
if (ctr >= 128 && ctr < 288)
|
|
return CPUMF_CTRSET_EXTENDED;
|
|
break;
|
|
}
|
|
if (csvn >= 3 && ctr >= 448 && ctr < 496)
|
|
return CPUMF_CTRSET_MT_DIAG;
|
|
return CPUMF_CTRSET_NONE;
|
|
}
|