mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
hyptop: allow users to set speedup factor
While calculating real CPU SMT utilization, the SMT speedup factor needs to be taken into account. Speedup factor depends on machine generations and variations on workload the machine has. The users should be able to determine the value according to their needs. Signed-off-by: Mete Durlu <meted@linux.ibm.com> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "lib/zt_common.h"
|
||||
|
||||
#define G0(x) MAX(0, (s64) (x))
|
||||
#define SMT_FACTOR_DEFAULT 1.3
|
||||
|
||||
/*
|
||||
* Helper Prototypes
|
||||
|
||||
@@ -74,6 +74,18 @@ In this mode no user input is accepted.
|
||||
.BR "\-d <SECONDS>" " or " "\-\-delay=<SECONDS>"
|
||||
Specifies the delay between screen updates.
|
||||
.TP
|
||||
.BR "\-m <FACTOR>" " or " "\-\-smt_factor=<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 <ITERATIONS>" " or " "\-\-iterations=<ITERATIONS>"
|
||||
Specifies the maximum number of iterations before ending.
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user