From: Sebastien GODARD Date: Sun, 26 Sep 2021 08:36:59 +0000 (+0200) Subject: iostat: Add --compact option (#303) X-Git-Tag: v12.5.5~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12ef011d2e4f016d8ceeb3cb9a8c4717eecfd781;p=sysstat iostat: Add --compact option (#303) This option tells iostat to not break a report into sub-reports, as --pretty option may do when there are many metrics to display. Signed-off-by: Sebastien GODARD --- diff --git a/iostat.c b/iostat.c index 6eddd8b..515d4e6 100644 --- a/iostat.c +++ b/iostat.c @@ -92,14 +92,14 @@ void usage(char *progname) fprintf(stderr, _("Options are:\n" "[ -c ] [ -d ] [ -h ] [ -k | -m ] [ -N ] [ -s ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ]\n" "[ { -f | +f } ] [ -j { ID | LABEL | PATH | UUID | ... } ]\n" - "[ --dec={ 0 | 1 | 2 } ] [ --human ] [ --pretty ] [ -o JSON ]\n" + "[ --compact ] [ --dec={ 0 | 1 | 2 } ] [ --human ] [ --pretty ] [ -o JSON ]\n" "[ [ -H ] -g ] [ -p [ [,...] | ALL ] ]\n" "[ [...] | ALL ] [ --debuginfo ]\n")); #else fprintf(stderr, _("Options are:\n" "[ -c ] [ -d ] [ -h ] [ -k | -m ] [ -N ] [ -s ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ]\n" "[ { -f | +f } ] [ -j { ID | LABEL | PATH | UUID | ... } ]\n" - "[ --dec={ 0 | 1 | 2 } ] [ --human ] [ --pretty ] [ -o JSON ]\n" + "[ --compact ] [ --dec={ 0 | 1 | 2 } ] [ --human ] [ --pretty ] [ -o JSON ]\n" "[ [ -H ] -g ] [ -p [ [,...] | ALL ] ]\n" "[ [...] | ALL ]\n")); #endif @@ -1795,7 +1795,8 @@ void write_stats(int curr, struct tm *rectime, int skip) if (DISPLAY_PRETTY(flags) && DISPLAY_EXTENDED(flags) && !DISPLAY_SHORT_OUTPUT(flags) && - !DISPLAY_JSON_OUTPUT(flags)) { + !DISPLAY_JSON_OUTPUT(flags) && + !DISPLAY_COMPACT(flags)) { hl = 1; hh = 4; } @@ -2126,6 +2127,11 @@ int main(int argc, char **argv) opt++; } + else if (!strcmp(argv[opt], "--compact")) { + flags |= I_D_COMPACT; + opt++; + } + #ifdef TEST else if (!strncmp(argv[opt], "--getenv", 8)) { __env = TRUE; diff --git a/iostat.h b/iostat.h index 261271c..6fff0bc 100644 --- a/iostat.h +++ b/iostat.h @@ -31,6 +31,7 @@ #define I_D_ZERO_OMIT 0x080000 #define I_D_UNIT 0x100000 #define I_D_SHORT_OUTPUT 0x200000 +#define I_D_COMPACT 0x400000 #define DISPLAY_CPU(m) (((m) & I_D_CPU) == I_D_CPU) #define DISPLAY_DISK(m) (((m) & I_D_DISK) == I_D_DISK) @@ -54,6 +55,7 @@ #define DISPLAY_UNIT(m) (((m) & I_D_UNIT) == I_D_UNIT) #define DISPLAY_SHORT_OUTPUT(m) (((m) & I_D_SHORT_OUTPUT) == I_D_SHORT_OUTPUT) #define USE_ALL_DIR(m) (((m) & I_D_ALL_DIR) == I_D_ALL_DIR) +#define DISPLAY_COMPACT(m) (((m) & I_D_COMPACT) == I_D_COMPACT) #define T_PART 0 #define T_DEV 1