From a4798a0062e93abd970ec48b6e677f27a25bbfd5 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Fri, 23 Mar 2018 12:25:44 +0100 Subject: [PATCH] mpstat: Remove option "-P ON" mpstat now doesn't display offline CPUs. So option "-P ON" used to tell mpstat to display only online CPUs is no longer needed. This is the same behavior as sar. Signed-off-by: Sebastien GODARD --- mpstat.c | 45 ++++++--------------------------------------- mpstat.h | 5 +---- 2 files changed, 7 insertions(+), 43 deletions(-) diff --git a/mpstat.c b/mpstat.c index 41dde2c..98e7a36 100644 --- a/mpstat.c +++ b/mpstat.c @@ -132,7 +132,7 @@ void usage(char *progname) fprintf(stderr, _("Options are:\n" "[ -A ] [ -n ] [ -u ] [ -V ] [ -I { SUM | CPU | SCPU | ALL } ]\n" - "[ -N { | ALL } ] [ -o JSON ] [ -P { | ON | ALL } ]\n")); + "[ -N { | ALL } ] [ -o JSON ] [ -P { | ALL } ]\n")); exit(1); } @@ -1084,17 +1084,6 @@ void write_plain_isumcpu_stats(int dis, unsigned long long itv, int prev, int cu scc->cpu_hardirq + scc->cpu_softirq) == 0) { /* This is an offline CPU */ - - if (!DISPLAY_ONLINE_CPU(flags)) { - /* - * Display offline CPU if requested by the user. - * Value displayed is 0.00. - */ - printf("%-11s", curr_string); - cprintf_in(IS_INT, " %4d", "", cpu - 1); - cprintf_f(NO_UNIT, 1, 9, 2, 0.0); - printf("\n"); - } continue; } @@ -1170,15 +1159,6 @@ void write_json_isumcpu_stats(int tab, unsigned long long itv, int prev, int cur scc->cpu_hardirq + scc->cpu_softirq) == 0) { /* This is an offline CPU */ - - if (!DISPLAY_ONLINE_CPU(flags)) { - /* - * Display offline CPU if requested by the user. - * Value displayed is 0.00. - */ - xprintf0(tab, "{\"cpu\": \"%d\", \"intr\": 0.00}", - cpu - 1); - } continue; } @@ -1333,13 +1313,9 @@ void write_plain_irqcpu_stats(struct stats_irqcpu *st_ic[], int ic_nr, int dis, if ((scc->cpu_user + scc->cpu_nice + scc->cpu_sys + scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal + - scc->cpu_hardirq + scc->cpu_softirq) == 0) { - + scc->cpu_hardirq + scc->cpu_softirq) == 0) /* Offline CPU found */ - - if (DISPLAY_ONLINE_CPU(flags)) - continue; - } + continue; printf("%-11s", curr_string); cprintf_in(IS_INT, " %3d", "", cpu - 1); @@ -1437,13 +1413,9 @@ void write_json_irqcpu_stats(int tab, struct stats_irqcpu *st_ic[], int ic_nr, if ((scc->cpu_user + scc->cpu_nice + scc->cpu_sys + scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal + - scc->cpu_hardirq + scc->cpu_softirq) == 0) { - + scc->cpu_hardirq + scc->cpu_softirq) == 0) /* Offline CPU found */ - - if (DISPLAY_ONLINE_CPU(flags)) - continue; - } + continue; if (nextcpu) { printf(",\n"); @@ -2079,12 +2051,7 @@ int main(int argc, char **argv) flags |= F_P_OPTION; dis_hdr = 9; - if (!strcmp(argv[opt], K_ON)) { - /* Display stats for all online CPU */ - flags |= F_P_ON; - memset(cpu_bitmap, ~0, BITMAP_SIZE(cpu_nr)); - } - else if (parse_values(argv[opt], cpu_bitmap, cpu_nr, K_LOWERALL)) { + if (parse_values(argv[opt], cpu_bitmap, cpu_nr, K_LOWERALL)) { usage(argv[0]); } } diff --git a/mpstat.h b/mpstat.h index 9da8406..2ceeb87 100644 --- a/mpstat.h +++ b/mpstat.h @@ -40,22 +40,19 @@ /* Indicate that option -P has been used */ #define F_P_OPTION 0x01 -/* Indicate that stats should be displayed on for online CPU ("-P ON") */ -#define F_P_ON 0x02 +/* 0x02: unused */ /* JSON output */ #define F_JSON_OUTPUT 0x04 /* Indicate that option -N has been used */ #define F_N_OPTION 0x08 #define USE_P_OPTION(m) (((m) & F_P_OPTION) == F_P_OPTION) -#define DISPLAY_ONLINE_CPU(m) (((m) & F_P_ON) == F_P_ON) #define DISPLAY_JSON_OUTPUT(m) (((m) & F_JSON_OUTPUT) == F_JSON_OUTPUT) #define USE_N_OPTION(m) (((m) & F_N_OPTION) == F_N_OPTION) #define K_SUM "SUM" #define K_CPU "CPU" #define K_SCPU "SCPU" -#define K_ON "ON" #define NR_IRQCPU_PREALLOC 3 -- 2.50.0