Fix percentile_list option
authorVincent Kang Fu <VFu@fusionio.com>
Sat, 2 Feb 2013 08:28:55 +0000 (09:28 +0100)
committerJens Axboe <axboe@kernel.dk>
Sat, 2 Feb 2013 08:28:55 +0000 (09:28 +0100)
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 <axboe@kernel.dk>
fio.h
init.c
options.c
parse.c
stat.c

diff --git a/fio.h b/fio.h
index d18029a04af7b8fe20a854c723e588261170e7fc..370ddaad483ea02f093420ca3a7cf9c936df5f10 100644 (file)
--- 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 dfc5a8fe981b12c2a55bcf0eeada5772e3d9d03f..52665f0273aa56dc949ee393b2c46d3669989059 100644 (file)
--- 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;
index 799e77a4375f8c49acba3502b59f07ea49217fbe..4522fe450c5daaf2c2394aed56ef87578c48cd62 100644 (file)
--- 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 d15d22ba3f7ed03a68e77614a02b44616d64daa5..3fda69cd263c79ffde4fd1f687f2091d816236f9 100644 (file)
--- 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 62eee9ab8736714d5518520c6995d3910c9169cb..fb5ff64f06859abc63f78cf14dd06311e1076a5e 100644 (file)
--- 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++;