mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
hyptop: Add option to show omitted fields on formatted output
Fields without a valid value are normally excluded from formatted output of hyptop. Add "--all" option to force hyptop to display those fields with null values. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Mete Durlu <meted@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
committed by
Steffen Eiden
parent
c5695e43c4
commit
617a8248e8
@@ -115,6 +115,13 @@ represent data for one system in one iteration.
|
||||
.PP
|
||||
This option implies the "\-\-batch-mode" option.
|
||||
.RE
|
||||
.BR "\-\-all"
|
||||
.RS
|
||||
Use this option with the "--format" option to include fields without valid
|
||||
values in the output. Fields without valid values are omitted from the output
|
||||
by default. When you use the "--all" option, the invalid values are included
|
||||
and shown as "null".
|
||||
.RE
|
||||
.TP
|
||||
.BR "\-d <SECONDS>" " or " "\-\-delay=<SECONDS>"
|
||||
Specifies the delay between screen updates.
|
||||
|
||||
@@ -229,10 +229,10 @@ static void l_fmt_init(void)
|
||||
|
||||
if (!g.o.format_specified)
|
||||
return;
|
||||
if (g.o.format == FMT_CSV) {
|
||||
if (g.o.format == FMT_CSV)
|
||||
flags |= FMT_QUOTEALL;
|
||||
if (g.o.format == FMT_CSV || g.o.format_all)
|
||||
flags |= FMT_KEEPINVAL;
|
||||
}
|
||||
if (g.o.format == FMT_JSON || g.o.format == FMT_JSONSEQ)
|
||||
flags |= FMT_HANDLEINT;
|
||||
util_fmt_init(stdout, g.o.format, flags, 1);
|
||||
|
||||
@@ -55,6 +55,7 @@ struct hyptop_opts {
|
||||
unsigned int win_specified;
|
||||
unsigned int batch_mode_specified;
|
||||
unsigned int format_specified;
|
||||
unsigned int format_all;
|
||||
enum util_fmt_t format;
|
||||
unsigned int iterations_specified;
|
||||
unsigned int iterations;
|
||||
|
||||
@@ -42,6 +42,8 @@ static char HELP_TEXT[] =
|
||||
"-t, --cpu-types TYPE[,..] CPU types used for time calculations\n"
|
||||
"-b, --batch-mode Use batch mode (no curses)\n"
|
||||
" --format FORMAT Output format (" FMT_TYPE_NAMES "), implies -b\n"
|
||||
" --all Include omitted fields (with values of null)\n"
|
||||
" in the output of --format.\n"
|
||||
"-d, --delay SECONDS Delay time between screen updates\n"
|
||||
"-m, --smt-factor FACTOR Machine generation dependent SMT speedup factor.\n"
|
||||
"-n, --iterations NUMBER Number of iterations before ending\n";
|
||||
@@ -50,6 +52,7 @@ static char HELP_TEXT[] =
|
||||
* Options with long-name only
|
||||
*/
|
||||
#define OPT_FORMAT 256 /* --format */
|
||||
#define OPT_FORMAT_ALL 261 /* --all*/
|
||||
|
||||
/*
|
||||
* Options with underscore to keep compatibility
|
||||
@@ -321,6 +324,15 @@ static void l_format_set(const char *str)
|
||||
g.o.format = fmt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the "--all" option to display omitted null values
|
||||
* while using "--format"
|
||||
*/
|
||||
static void l_format_all_set(void)
|
||||
{
|
||||
g.o.format_all = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make option consisteny checks at end of command line parsing
|
||||
*/
|
||||
@@ -328,6 +340,8 @@ static void l_parse_finish(void)
|
||||
{
|
||||
if (g.o.iterations_specified && g.o.iterations == 0)
|
||||
hyptop_exit(0);
|
||||
if (!g.o.format_specified && g.o.format_all)
|
||||
ERR_EXIT("The --all option requires the -–format option\n");
|
||||
if (g.o.cur_win != &win_sys)
|
||||
return;
|
||||
if (!win_sys.opts.sys.specified)
|
||||
@@ -349,6 +363,7 @@ void opts_parse(int argc, char *argv[])
|
||||
{ "help", no_argument, NULL, 'h'},
|
||||
{ "batch-mode", no_argument, NULL, 'b'},
|
||||
{ "batch_mode", no_argument, NULL, OPT_BATCH_MODE},
|
||||
{ "all", no_argument, NULL, OPT_FORMAT_ALL },
|
||||
{ "delay", required_argument, NULL, 'd'},
|
||||
{ "smt-factor", required_argument, NULL, 'm'},
|
||||
{ "smt_factor", required_argument, NULL, OPT_SMT_FACTOR},
|
||||
@@ -412,6 +427,9 @@ void opts_parse(int argc, char *argv[])
|
||||
case OPT_FORMAT:
|
||||
l_format_set(optarg);
|
||||
break;
|
||||
case OPT_FORMAT_ALL:
|
||||
l_format_all_set();
|
||||
break;
|
||||
default:
|
||||
l_std_usage_exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user