hyptop/opts: Replace long option formats for consistency

Hyptop uses underscore("_") in between words for options, this breaks
consistency. Use hyphens ("-") in between words in options moving
forward. Underscore formats are still supported for compatibility.

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
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:
Mete Durlu
2025-12-03 12:48:33 +01:00
committed by Steffen Eiden
parent 7b3add9389
commit c5695e43c4
2 changed files with 28 additions and 12 deletions

View File

@@ -62,11 +62,11 @@ shown.
Select sort field for current window. To reverse the sort order, specify the Select sort field for current window. To reverse the sort order, specify the
option twice. See FIELDS below for definitions. option twice. See FIELDS below for definitions.
.TP .TP
.BR "\-t <TYPE>,..." " or " "\-\-cpu_types=<TYPE>,..." .BR "\-t <TYPE>,..." " or " "\-\-cpu-types=<TYPE>,..."
Select CPU types that are used for CPU time calculations. See CPU TYPES Select CPU types that are used for CPU time calculations. See CPU TYPES
below for definitions. below for definitions.
.TP .TP
.BR "\-b" " or " "\-\-batch_mode" .BR "\-b" " or " "\-\-batch-mode"
Use batch mode (no curses). This can be useful for sending output from hyptop Use batch mode (no curses). This can be useful for sending output from hyptop
to another program, a file, or a line mode terminal. to another program, a file, or a line mode terminal.
In this mode no user input is accepted. In this mode no user input is accepted.
@@ -113,13 +113,13 @@ All values are enclosed in double quotation marks and separated by commas. The
first line of output contains a list of headings. Subsequent lines each first line of output contains a list of headings. Subsequent lines each
represent data for one system in one iteration. represent data for one system in one iteration.
.PP .PP
This option implies the "\-\-batch_mode" option. This option implies the "\-\-batch-mode" option.
.RE .RE
.TP .TP
.BR "\-d <SECONDS>" " or " "\-\-delay=<SECONDS>" .BR "\-d <SECONDS>" " or " "\-\-delay=<SECONDS>"
Specifies the delay between screen updates. Specifies the delay between screen updates.
.TP .TP
.BR "\-m <FACTOR>" " or " "\-\-smt_factor=<FACTOR>" .BR "\-m <FACTOR>" " or " "\-\-smt-factor=<FACTOR>"
Specifies a workload dependent SMT speedup factor. Specifies a workload dependent SMT speedup factor.
For IBM z15 servers, the default value is 1.3. If the workload benefits For IBM z15 servers, the default value is 1.3. If the workload benefits
from SMT, you can specify a higher value. If the workload does not benefit from SMT, you can specify a higher value. If the workload does not benefit
@@ -239,7 +239,7 @@ The following units are supported:
.SH CPU TYPES .SH CPU TYPES
Depending on the hypervisor different CPU types are supported. These CPU Depending on the hypervisor different CPU types are supported. These CPU
types can be selected either interactively or with the "--cpu_types" types can be selected either interactively or with the "--cpu-types"
command line option. The calculation of the CPU data only uses CPUs of command line option. The calculation of the CPU data only uses CPUs of
the specified types. the specified types.

View File

@@ -39,11 +39,11 @@ static char HELP_TEXT[] =
"-s, --sys SYSTEM[,..] Systems for current window\n" "-s, --sys SYSTEM[,..] Systems for current window\n"
"-f, --fields LETTER[:UNIT][,..] Fields and units for current window\n" "-f, --fields LETTER[:UNIT][,..] Fields and units for current window\n"
"-S, --sort LETTER Sort field for current window\n" "-S, --sort LETTER Sort field for current window\n"
"-t, --cpu_types TYPE[,..] CPU types used for time calculations\n" "-t, --cpu-types TYPE[,..] CPU types used for time calculations\n"
"-b, --batch_mode Use batch mode (no curses)\n" "-b, --batch-mode Use batch mode (no curses)\n"
" --format FORMAT Output format (" FMT_TYPE_NAMES "), implies -b\n" " --format FORMAT Output format (" FMT_TYPE_NAMES "), implies -b\n"
"-d, --delay SECONDS Delay time between screen updates\n" "-d, --delay SECONDS Delay time between screen updates\n"
"-m, --smt_factor FACTOR Machine generation dependent SMT speedup factor.\n" "-m, --smt-factor FACTOR Machine generation dependent SMT speedup factor.\n"
"-n, --iterations NUMBER Number of iterations before ending\n"; "-n, --iterations NUMBER Number of iterations before ending\n";
/* /*
@@ -51,6 +51,14 @@ static char HELP_TEXT[] =
*/ */
#define OPT_FORMAT 256 /* --format */ #define OPT_FORMAT 256 /* --format */
/*
* Options with underscore to keep compatibility
*/
#define OPT_BATCH_MODE 257 /* --batch_mode */
#define OPT_SORT_FIELD 258 /* --sort | --sort_field */
#define OPT_CPU_TYPES 259 /* --cpu_types */
#define OPT_SMT_FACTOR 260 /* --smt_factor */
/* /*
* Initialize default settings * Initialize default settings
*/ */
@@ -339,15 +347,19 @@ void opts_parse(int argc, char *argv[])
static struct option long_options[] = { static struct option long_options[] = {
{ "version", no_argument, NULL, 'v'}, { "version", no_argument, NULL, 'v'},
{ "help", no_argument, NULL, 'h'}, { "help", no_argument, NULL, 'h'},
{ "batch_mode", no_argument, NULL, 'b'}, { "batch-mode", no_argument, NULL, 'b'},
{ "batch_mode", no_argument, NULL, OPT_BATCH_MODE},
{ "delay", required_argument, NULL, 'd'}, { "delay", required_argument, NULL, 'd'},
{ "smt_factor", required_argument, NULL, 'm'}, { "smt-factor", required_argument, NULL, 'm'},
{ "smt_factor", required_argument, NULL, OPT_SMT_FACTOR},
{ "window", required_argument, NULL, 'w'}, { "window", required_argument, NULL, 'w'},
{ "sys", required_argument, NULL, 's'}, { "sys", required_argument, NULL, 's'},
{ "iterations", required_argument, NULL, 'n'}, { "iterations", required_argument, NULL, 'n'},
{ "fields", required_argument, NULL, 'f'}, { "fields", required_argument, NULL, 'f'},
{ "sort_field", required_argument, NULL, 'S'}, { "sort-field", required_argument, NULL, 'S'},
{ "cpu_types", required_argument, NULL, 't'}, { "sort_field", required_argument, NULL, OPT_SORT_FIELD},
{ "cpu-types", required_argument, NULL, 't'},
{ "cpu_types", required_argument, NULL, OPT_CPU_TYPES},
{ "format", required_argument, NULL, OPT_FORMAT }, { "format", required_argument, NULL, OPT_FORMAT },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@@ -366,12 +378,14 @@ void opts_parse(int argc, char *argv[])
case 'h': case 'h':
l_usage(); l_usage();
hyptop_exit(0); hyptop_exit(0);
case OPT_BATCH_MODE:
case 'b': case 'b':
l_batch_mode_set(); l_batch_mode_set();
break; break;
case 'd': case 'd':
l_delay_set(optarg); l_delay_set(optarg);
break; break;
case OPT_SMT_FACTOR:
case 'm': case 'm':
l_factor_set(optarg); l_factor_set(optarg);
break; break;
@@ -384,12 +398,14 @@ void opts_parse(int argc, char *argv[])
case 'n': case 'n':
l_iterations_set(optarg); l_iterations_set(optarg);
break; break;
case OPT_CPU_TYPES:
case 't': case 't':
l_cpu_types_set(optarg); l_cpu_types_set(optarg);
break; break;
case 'f': case 'f':
l_fields_set(optarg); l_fields_set(optarg);
break; break;
case OPT_SORT_FIELD:
case 'S': case 'S':
l_sort_field_set(optarg); l_sort_field_set(optarg);
break; break;