From fd112d34a2cfdc2d9efcd394e38b6d87b357c23d Mon Sep 17 00:00:00 2001 From: Vincent Kang Fu Date: Sat, 2 Feb 2013 09:28:55 +0100 Subject: [PATCH] Fix percentile_list option Commit 802ad4a8 broke the parsing of the percentile list, by neglecting to change the parser type fo a fio_fp64_t. Also get rid of the def_percentile_list, just set the default percentile list as the option default. Signed-off-by: Jens Axboe --- fio.h | 2 -- init.c | 25 +------------------------ options.c | 2 +- parse.c | 11 +++-------- stat.c | 5 +---- 5 files changed, 6 insertions(+), 39 deletions(-) diff --git a/fio.h b/fio.h index d18029a0..370ddaad 100644 --- a/fio.h +++ b/fio.h @@ -248,7 +248,6 @@ struct thread_options { unsigned int trim_zero; unsigned long long trim_backlog; unsigned int clat_percentiles; - unsigned int overwrite_plist; fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN]; char *read_iolog_file; @@ -606,7 +605,6 @@ extern int is_backend; extern int nr_clients; extern int log_syslog; extern const char fio_version_string[]; -extern const fio_fp64_t def_percentile_list[FIO_IO_U_LIST_MAX_LEN]; extern struct thread_data *threads; diff --git a/init.c b/init.c index dfc5a8fe..52665f02 100644 --- a/init.c +++ b/init.c @@ -67,26 +67,6 @@ unsigned int *fio_debug_jobp = NULL; static char cmd_optstr[256]; static int did_arg; -const fio_fp64_t def_percentile_list[FIO_IO_U_LIST_MAX_LEN] = { - { .u.f = 1.00 }, - { .u.f = 5.00 }, - { .u.f = 10.00 }, - { .u.f = 20.00 }, - { .u.f = 30.00 }, - { .u.f = 40.00 }, - { .u.f = 50.00 }, - { .u.f = 60.00 }, - { .u.f = 70.00 }, - { .u.f = 80.00 }, - { .u.f = 90.00 }, - { .u.f = 95.00 }, - { .u.f = 99.00 }, - { .u.f = 99.50 }, - { .u.f = 99.90 }, - { .u.f = 99.95 }, - { .u.f = 99.99 }, -}; - #define FIO_CLIENT_FLAG (1 << 16) /* @@ -887,10 +867,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num) td->mutex = fio_mutex_init(FIO_MUTEX_LOCKED); td->ts.clat_percentiles = td->o.clat_percentiles; - if (td->o.overwrite_plist) - memcpy(td->ts.percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list)); - else - memcpy(td->ts.percentile_list, def_percentile_list, sizeof(def_percentile_list)); + memcpy(td->ts.percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list)); for (i = 0; i < DDIR_RWDIR_CNT; i++) { td->ts.clat_stat[i].min_val = ULONG_MAX; diff --git a/options.c b/options.c index 799e77a4..4522fe45 100644 --- a/options.c +++ b/options.c @@ -2434,8 +2434,8 @@ static struct fio_option options[FIO_MAX_OPTS] = { .name = "percentile_list", .type = FIO_OPT_FLOAT_LIST, .off1 = td_var_offset(percentile_list), - .off2 = td_var_offset(overwrite_plist), .help = "Specify a custom list of percentiles to report", + .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99", .maxlen = FIO_IO_U_LIST_MAX_LEN, .minfp = 0.0, .maxfp = 100.0, diff --git a/parse.c b/parse.c index d15d22ba..3fda69cd 100644 --- a/parse.c +++ b/parse.c @@ -15,6 +15,7 @@ #include "debug.h" #include "options.h" #include "minmax.h" +#include "lib/ieee754.h" static struct fio_option *fio_options; extern unsigned int fio_get_kb_base(void *); @@ -362,7 +363,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, int first, int more, int curr) { int il, *ilp; - double* flp; + fio_fp64_t *flp; long long ull, *ullp; long ul1, ul2; double uf; @@ -500,12 +501,6 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, break; } case FIO_OPT_FLOAT_LIST: { - - if (first) { - ul2 = 1; - ilp = td_var(data, o->off2); - *ilp = ul2; - } if (curr >= o->maxlen) { log_err("the list exceeding max length %d\n", o->maxlen); @@ -527,7 +522,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, } flp = td_var(data, o->off1); - flp[curr] = uf; + flp[curr].u.f = uf; break; } diff --git a/stat.c b/stat.c index 62eee9ab..fb5ff64f 100644 --- a/stat.c +++ b/stat.c @@ -1210,10 +1210,7 @@ void show_run_stats(void) ts = &threadstats[j]; ts->clat_percentiles = td->o.clat_percentiles; - if (td->o.overwrite_plist) - memcpy(ts->percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list)); - else - memcpy(ts->percentile_list, def_percentile_list, sizeof(def_percentile_list)); + memcpy(ts->percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list)); idx++; ts->members++; -- 2.25.1