diff --git a/hyptop/helper.c b/hyptop/helper.c index 85b06682..9c0f6c89 100644 --- a/hyptop/helper.c +++ b/hyptop/helper.c @@ -402,7 +402,7 @@ void hyptop_helper_init(void) s64 ht_calculate_smt_util(u64 core_us, u64 thr_us, u64 mgm_us, int thread_per_core) { s64 component1, component2, smt_us; - double smt_factor = SMT_FACTOR_DEFAULT; + double smt_factor = g.o.smt_factor; component1 = G0(thread_per_core * core_us - thr_us); if (thread_per_core > 1) diff --git a/hyptop/helper.h b/hyptop/helper.h index 5ed92519..9679c2aa 100644 --- a/hyptop/helper.h +++ b/hyptop/helper.h @@ -21,7 +21,6 @@ #include "lib/zt_common.h" #define G0(x) MAX(0, (s64) (x)) -#define SMT_FACTOR_DEFAULT 1.3 /* * Helper Prototypes diff --git a/hyptop/hyptop.8 b/hyptop/hyptop.8 index 739835cc..bac826bd 100644 --- a/hyptop/hyptop.8 +++ b/hyptop/hyptop.8 @@ -74,6 +74,18 @@ In this mode no user input is accepted. .BR "\-d " " or " "\-\-delay=" Specifies the delay between screen updates. .TP +.BR "\-m " " or " "\-\-smt_factor=" +Specifies a workload dependent SMT speedup factor. +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, specifying lower values results in more accurate reports of +real CPU SMT utilization field for LPARs. There is no hard boundary except +that it must be a positive value. Example ranges to select a sensible value +from: + + For IBM z13: [0.8, 1.3] + For IBM z15: [1.1, 1.5] +.TP .BR "\-n " " or " "\-\-iterations=" Specifies the maximum number of iterations before ending. diff --git a/hyptop/hyptop.h b/hyptop/hyptop.h index 7648bbf4..0ce68873 100644 --- a/hyptop/hyptop.h +++ b/hyptop/hyptop.h @@ -22,6 +22,7 @@ #include "table.h" #define HYPTOP_OPT_DEFAULT_DELAY 2 +#define HYPTOP_OPT_DEFAULT_SMT_SCALE 1.3 #define HYPTOP_MAX_WIN_DEPTH 4 #define HYPTOP_MAX_LINE 512 #define PROG_NAME "hyptop" @@ -60,6 +61,8 @@ struct hyptop_opts { int delay_s; int delay_us; + + double smt_factor; }; /* diff --git a/hyptop/opts.c b/hyptop/opts.c index 07dca3a2..13953a0c 100644 --- a/hyptop/opts.c +++ b/hyptop/opts.c @@ -39,6 +39,7 @@ static char HELP_TEXT[] = "-t, --cpu_types TYPE[,..] CPU types used for time calculations\n" "-b, --batch_mode Use batch mode (no curses)\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"; /* @@ -48,6 +49,7 @@ static void l_init_defaults(void) { g.prog_name = PROG_NAME; g.o.delay_s = HYPTOP_OPT_DEFAULT_DELAY; + g.o.smt_factor = HYPTOP_OPT_DEFAULT_SMT_SCALE; g.w.cur = &win_sys_list; g.o.cur_win = &win_sys_list; } @@ -108,6 +110,20 @@ static void l_delay_set(char *delay_string) g.o.delay_us = 0; } +/* + * Set SMT factor option + */ +static void l_factor_set(char *value_string) +{ + double factor; + + if (sscanf(value_string, "%lf", &factor) != 1) + ERR_EXIT("The SMT factor \"%s\" is invalid\n", value_string); + if (factor <= 0) + ERR_EXIT("The SMT factor \"%s\" is <= 0\n", value_string); + g.o.smt_factor = factor; +} + /* * Get number of occurrences of character 'c' in "str" */ @@ -299,6 +315,7 @@ void opts_parse(int argc, char *argv[]) { "help", no_argument, NULL, 'h'}, { "batch_mode", no_argument, NULL, 'b'}, { "delay", required_argument, NULL, 'd'}, + { "smt_factor", required_argument, NULL, 'm'}, { "window", required_argument, NULL, 'w'}, { "sys", required_argument, NULL, 's'}, { "iterations", required_argument, NULL, 'n'}, @@ -307,7 +324,7 @@ void opts_parse(int argc, char *argv[]) { "cpu_types", required_argument, NULL, 't'}, { NULL, 0, NULL, 0 } }; - static const char option_string[] = "vhbd:w:s:n:f:t:S:"; + static const char option_string[] = "vhbd:m:w:s:n:f:t:S:"; l_init_defaults(); while (1) { @@ -328,6 +345,9 @@ void opts_parse(int argc, char *argv[]) case 'd': l_delay_set(optarg); break; + case 'm': + l_factor_set(optarg); + break; case 'w': l_window_set(optarg); break;