Allow options to specify intervals
authorJens Axboe <axboe@kernel.dk>
Fri, 16 Mar 2012 18:57:23 +0000 (19:57 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 16 Mar 2012 18:57:23 +0000 (19:57 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
goptions.c
options.c
parse.h

index b6a6b6b33947fe2c2833318c65365184025c494d..85ef660d321ac077d98b9d2d17ec0d0eaea2d5d6 100644 (file)
@@ -134,7 +134,7 @@ static struct gopt *__gopt_new_int(struct fio_option *o, unsigned long long *p)
 {
        unsigned long long defval;
        struct gopt_int *i;
-       guint maxval;
+       guint maxval, interval;
        GtkWidget *label;
 
        i = malloc(sizeof(*i));
@@ -156,7 +156,11 @@ static struct gopt *__gopt_new_int(struct fio_option *o, unsigned long long *p)
                defval = val;
        }
 
-       i->spin = gtk_spin_button_new_with_range(o->minval, maxval, 1.0);
+       interval = 1.0;
+       if (o->interval)
+               interval = o->interval;
+
+       i->spin = gtk_spin_button_new_with_range(o->minval, maxval, interval);
        gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(i->spin), GTK_UPDATE_IF_VALID);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(i->spin), defval);
 
@@ -249,6 +253,7 @@ static struct gopt *gopt_new_int_range(struct fio_option *o, unsigned int **ip)
        struct gopt_range *r;
        gint maxval, defval;
        GtkWidget *label;
+       guint interval;
        int i;
 
        r = malloc(sizeof(*r));
@@ -268,8 +273,12 @@ static struct gopt *gopt_new_int_range(struct fio_option *o, unsigned int **ip)
                defval = val;
        }
 
+       interval = 1.0;
+       if (o->interval)
+               interval = o->interval;
+
        for (i = 0; i < GOPT_RANGE_SPIN; i++) {
-               r->spins[i] = gtk_spin_button_new_with_range(o->minval, maxval, 512);
+               r->spins[i] = gtk_spin_button_new_with_range(o->minval, maxval, interval);
                gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(r->spins[i]), GTK_UPDATE_IF_VALID);
                if (ip)
                        gtk_spin_button_set_value(GTK_SPIN_BUTTON(r->spins[i]), *ip[i]);
index 03f9d413cafe2561ed860a516105703a7946b030..93f7f477acc8dafd214c03ec910e53052997d3e1 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1170,6 +1170,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(iodepth),
                .help   = "Number of IO buffers to keep in flight",
                .minval = 1,
+               .interval = 1,
                .def    = "1",
                .category = FIO_OPT_G_IO,
        },
@@ -1181,6 +1182,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .help   = "Number of IO buffers to submit in one go",
                .parent = "iodepth",
                .minval = 1,
+               .interval = 1,
                .def    = "1",
                .category = FIO_OPT_G_IO,
        },
@@ -1191,6 +1193,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .help   = "Number of IO buffers to retrieve in one go",
                .parent = "iodepth",
                .minval = 0,
+               .interval = 1,
                .def    = "1",
                .category = FIO_OPT_G_IO,
        },
@@ -1200,6 +1203,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(iodepth_low),
                .help   = "Low water mark for queuing depth",
                .parent = "iodepth",
+               .interval = 1,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1207,6 +1211,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .type   = FIO_OPT_STR_VAL,
                .cb     = str_size_cb,
                .help   = "Total size of device or files",
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1225,6 +1230,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off2   = td_var_offset(file_size_high),
                .minval = 1,
                .help   = "Size of individual files",
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_IO | FIO_OPT_G_FILE,
        },
        {
@@ -1234,6 +1240,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(start_offset),
                .help   = "Start IO from this offset",
                .def    = "0",
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1243,6 +1250,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .help   = "What is the increment from one offset to the next",
                .parent = "offset",
                .def    = "0",
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1255,6 +1263,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .help   = "Block size unit",
                .def    = "4k",
                .parent = "rw",
+               .interval = 512,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1266,6 +1275,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .minval = 1,
                .help   = "IO block offset alignment",
                .parent = "rw",
+               .interval = 512,
                .category = FIO_OPT_G_IO | FIO_OPT_G_IO_BUF,
        },
        {
@@ -1279,6 +1289,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .minval = 1,
                .help   = "Set block size range (in more detail than bs)",
                .parent = "rw",
+               .interval = 4096,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1340,6 +1351,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(nr_files),
                .help   = "Split job workload between this number of files",
                .def    = "1",
+               .interval = 1,
                .category = FIO_OPT_G_FILE,
        },
        {
@@ -1422,6 +1434,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(fsync_blocks),
                .help   = "Issue fsync for writes every given number of blocks",
                .def    = "0",
+               .interval = 1,
                .category = FIO_OPT_G_FILE,
        },
        {
@@ -1430,6 +1443,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(fdatasync_blocks),
                .help   = "Issue fdatasync for writes every given number of blocks",
                .def    = "0",
+               .interval = 1,
                .category = FIO_OPT_G_FILE,
        },
        {
@@ -1438,6 +1452,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(barrier_blocks),
                .help   = "Make every Nth write a barrier write",
                .def    = "0",
+               .interval = 1,
                .category = FIO_OPT_G_IO,
        },
 #ifdef FIO_HAVE_SYNC_FILE_RANGE
@@ -1499,6 +1514,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(loops),
                .help   = "Number of times to run the job",
                .def    = "1",
+               .interval = 1,
                .category = FIO_OPT_G_MISC,
        },
        {
@@ -1507,6 +1523,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(numjobs),
                .help   = "Duplicate this job this many times",
                .def    = "1",
+               .interval = 1,
                .category = FIO_OPT_G_MISC,
        },
        {
@@ -1700,6 +1717,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .minval = 2 * sizeof(struct verify_header),
                .help   = "Store verify buffer header every N bytes",
                .parent = "verify",
+               .interval = 2 * sizeof(struct verify_header),
                .category = FIO_OPT_G_IO | FIO_OPT_G_VERIFY,
        },
        {
@@ -1777,15 +1795,17 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .name   = "trim_percentage",
                .type   = FIO_OPT_INT,
                .cb     = str_verify_trim_cb,
+               .minval = 0,
                .maxval = 100,
                .help   = "Number of verify blocks to discard/trim",
                .parent = "verify",
                .def    = "0",
+               .interval = 1,
                .category = FIO_OPT_G_IO,
        },
        {
                .name   = "trim_verify_zero",
-               .type   = FIO_OPT_INT,
+               .type   = FIO_OPT_BOOL,
                .help   = "Verify that trim/discarded blocks are returned as zeroes",
                .off1   = td_var_offset(trim_zero),
                .parent = "trim_percentage",
@@ -1798,6 +1818,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(trim_backlog),
                .help   = "Trim after this number of blocks are written",
                .parent = "trim_percentage",
+               .interval = 1,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1806,6 +1827,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(trim_batch),
                .help   = "Trim this number of IO blocks",
                .parent = "trim_percentage",
+               .interval = 1,
                .category = FIO_OPT_G_IO,
        },
 #endif
@@ -1825,7 +1847,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
        },
        {
                .name   = "replay_no_stall",
-               .type   = FIO_OPT_INT,
+               .type   = FIO_OPT_BOOL,
                .off1   = td_var_offset(no_stall),
                .def    = "0",
                .parent = "read_iolog",
@@ -1869,6 +1891,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(zone_size),
                .help   = "Amount of data to read per zone",
                .def    = "0",
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_IO | FIO_OPT_G_ZONE,
        },
        {
@@ -1877,6 +1900,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(zone_range),
                .help   = "Give size of an IO zone",
                .def    = "0",
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_IO | FIO_OPT_G_ZONE,
        },
        {
@@ -1885,6 +1909,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(zone_skip),
                .help   = "Space between IO zones",
                .def    = "0",
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_IO | FIO_OPT_G_ZONE,
        },
        {
@@ -1893,6 +1918,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .cb     = str_lockmem_cb,
                .help   = "Lock down this amount of memory",
                .def    = "0",
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_OS | FIO_OPT_G_MEM,
        },
        {
@@ -1902,6 +1928,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .maxval = 100,
                .help   = "Percentage of mixed workload that is reads",
                .def    = "50",
+               .interval = 5,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1911,6 +1938,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .maxval = 100,
                .help   = "Percentage of mixed workload that is writes",
                .def    = "50",
+               .interval = 5,
                .category = FIO_OPT_G_IO,
        },
        {
@@ -1926,6 +1954,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .minval = -19,
                .maxval = 20,
                .def    = "0",
+               .interval = 1,
                .category = FIO_OPT_G_OS | FIO_OPT_G_CPU,
        },
 #ifdef FIO_HAVE_IOPRIO
@@ -1936,6 +1965,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .help   = "Set job IO priority value",
                .minval = 0,
                .maxval = 7,
+               .interval = 1,
                .category = FIO_OPT_G_OS | FIO_OPT_G_CPU,
        },
        {
@@ -1945,6 +1975,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .help   = "Set job IO priority class",
                .minval = 0,
                .maxval = 3,
+               .interval = 1,
                .category = FIO_OPT_G_OS | FIO_OPT_G_CPU,
        },
 #endif
@@ -2042,6 +2073,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                          " (msec)",
                .def    = "500",
                .parent = "write_bw_log",
+               .interval = 100,
                .category = FIO_OPT_G_LOG | FIO_OPT_G_STAT,
        },
        {
@@ -2051,6 +2083,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .help   = "Time window over which to calculate IOPS (msec)",
                .def    = "500",
                .parent = "write_iops_log",
+               .interval = 100,
                .category = FIO_OPT_G_LOG | FIO_OPT_G_STAT,
        },
        {
@@ -2167,7 +2200,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .name   = "thread",
                .type   = FIO_OPT_STR_SET,
                .off1   = td_var_offset(use_thread),
-               .help   = "Use threads instead of forks",
+               .help   = "Use threads instead of processes",
                .category = FIO_OPT_G_MISC | FIO_OPT_G_OS | FIO_OPT_G_JOB,
        },
        {
@@ -2208,6 +2241,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(hugepage_size),
                .help   = "When using hugepages, specify size of each page",
                .def    = __fio_stringify(FIO_HUGE_PAGE),
+               .interval = 1024 * 1024,
                .category = FIO_OPT_G_OS | FIO_OPT_G_MEM,
        },
        {
@@ -2246,6 +2280,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .maxval = 100,
                .minval = 1,
                .help   = "How compressible the buffer is (approximately)",
+               .interval = 5,
                .category = FIO_OPT_G_IO_BUF,
        },
        {
@@ -2254,6 +2289,7 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .off1   = td_var_offset(compress_chunk),
                .parent = "buffer_compress_percentage",
                .help   = "Size of compressible region in buffer",
+               .interval = 256,
                .category = FIO_OPT_G_IO_BUF,
        },
        {
diff --git a/parse.h b/parse.h
index b3d86138f25a4474a65cf67bd63d1dab5a35e871..e1b9311cc4bf4b5364ee2c39fb01fd1d53322b6f 100644 (file)
--- a/parse.h
+++ b/parse.h
@@ -51,6 +51,7 @@ struct fio_option {
        int minval;
        double maxfp;                   /* max and min floating value */
        double minfp;
+       unsigned int interval;          /* client hint for suitable interval */
        unsigned int maxlen;            /* max length */
        int neg;                        /* negate value stored */
        int prio;