mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cpumf/lshwc: Add flag to hide undefined counters of each counter set
Add command line option -H to hide counter value numbers from counters which are not defined in a counter set. They are usually all zero and are of no interest. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
718907d9ba
commit
283ae4dd2f
@@ -56,6 +56,7 @@ static unsigned char *ioctlbuffer;
|
||||
static bool allcpu;
|
||||
static char *ctrformat = "%ld";
|
||||
static bool shortname;
|
||||
static bool hideundef;
|
||||
|
||||
static unsigned int max_possible_cpus; /* No of possible CPUs */
|
||||
static struct ctrname { /* List of defined counters */
|
||||
@@ -343,6 +344,8 @@ static void show_header(void)
|
||||
for (size_t i = 0; i < ARRAY_SIZE(ctrname); ++i) {
|
||||
if (!ctrname[i].hitcnt)
|
||||
continue;
|
||||
if (hideundef && !ctrname[i].name)
|
||||
continue;
|
||||
if (comma)
|
||||
putchar(',');
|
||||
if (shortname) {
|
||||
@@ -376,6 +379,8 @@ static void line(char *header)
|
||||
for (size_t i = 0; i < ARRAY_SIZE(ctrname); ++i) {
|
||||
if (!ctrname[i].hitcnt)
|
||||
continue;
|
||||
if (hideundef && !ctrname[i].name)
|
||||
continue;
|
||||
if (comma)
|
||||
putchar(',');
|
||||
printf(ctrformat, ctrname[i].ccv[h]);
|
||||
@@ -391,6 +396,8 @@ static void line(char *header)
|
||||
for (size_t i = 0; i < ARRAY_SIZE(ctrname); ++i) {
|
||||
if (!ctrname[i].hitcnt)
|
||||
continue;
|
||||
if (hideundef && !ctrname[i].name)
|
||||
continue;
|
||||
if (comma)
|
||||
putchar(',');
|
||||
printf(ctrformat, ctrname[i].total);
|
||||
@@ -658,6 +665,10 @@ static struct util_opt opt_vec[] = {
|
||||
.option = { "hex", no_argument, NULL, 'x' },
|
||||
.desc = "Counter values in hexadecimal format"
|
||||
},
|
||||
{
|
||||
.option = { "hide", no_argument, NULL, 'H' },
|
||||
.desc = "Do not display undefined counters of a counter set"
|
||||
},
|
||||
UTIL_OPT_HELP,
|
||||
UTIL_OPT_VERSION,
|
||||
UTIL_OPT_END
|
||||
@@ -718,6 +729,9 @@ int main(int argc, char **argv)
|
||||
if (errno || *slash)
|
||||
errx(EXIT_FAILURE, "Invalid argument for -%c", ch);
|
||||
break;
|
||||
case 'H':
|
||||
hideundef = true;
|
||||
break;
|
||||
case 's':
|
||||
shortname = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user