Add total latency log
[fio.git] / options.c
index bdb56d3e4bec652a58b8f2fe02bdb78656f62fca..de691eb32144ef0468341639ef5fc79aab0d441c 100644 (file)
--- a/options.c
+++ b/options.c
@@ -16,6 +16,8 @@
 #include "lib/fls.h"
 #include "options.h"
 
+#include "crc/crc32c.h"
+
 /*
  * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
  */
@@ -225,6 +227,21 @@ static int str_mem_cb(void *data, const char *mem)
        return 0;
 }
 
+static int str_verify_cb(void *data, const char *mem)
+{
+       struct thread_data *td = data;
+
+       if (td->o.verify != VERIFY_CRC32C_INTEL)
+               return 0;
+
+       if (!crc32c_intel_works()) {
+               log_info("fio: System does not support hw accelerated crc32c. Falling back to sw crc32c.\n");
+               td->o.verify = VERIFY_CRC32C;
+       }
+
+       return 0;
+}
+
 static int fio_clock_source_cb(void *data, const char *str)
 {
        struct thread_data *td = data;
@@ -693,6 +710,7 @@ static int str_gtod_reduce_cb(void *data, int *il)
        struct thread_data *td = data;
        int val = *il;
 
+       td->o.disable_lat = !!val;
        td->o.disable_clat = !!val;
        td->o.disable_slat = !!val;
        td->o.disable_bw = !!val;
@@ -1231,7 +1249,6 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .cb     = fio_clock_source_cb,
                .off1   = td_var_offset(clocksource),
                .help   = "What type of timing source to use",
-               .def    = "gettimeofday",
                .posval = {
                          { .ival = "gettimeofday",
                            .oval = CS_GTOD,
@@ -1299,6 +1316,7 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .type   = FIO_OPT_STR,
                .off1   = td_var_offset(verify),
                .help   = "Verify data written",
+               .cb     = str_verify_cb,
                .def    = "0",
                .posval = {
                          { .ival = "0",
@@ -1411,6 +1429,20 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .help   = "Number of async verifier threads to use",
                .parent = "verify",
        },
+       {
+               .name   = "verify_backlog",
+               .type   = FIO_OPT_STR_VAL,
+               .off1   = td_var_offset(verify_backlog),
+               .help   = "Verify after this number of blocks are written",
+               .parent = "verify",
+       },
+       {
+               .name   = "verify_backlog_batch",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(verify_batch),
+               .help   = "Verify this number of IO blocks",
+               .parent = "verify_backlog",
+       },
 #ifdef FIO_HAVE_CPU_AFFINITY
        {
                .name   = "verify_async_cpus",
@@ -1760,6 +1792,14 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .cb     = str_gtod_reduce_cb,
                .def    = "0",
        },
+       {
+               .name   = "disable_lat",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(disable_lat),
+               .help   = "Disable latency numbers",
+               .parent = "gtod_reduce",
+               .def    = "0",
+       },
        {
                .name   = "disable_clat",
                .type   = FIO_OPT_BOOL,
@@ -1818,6 +1858,13 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .minval = 100,
                .maxval = 1000,
        },
+       {
+               .name   = "cgroup_nodelete",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(cgroup_nodelete),
+               .help   = "Do not delete cgroups after job completion",
+               .def    = "0",
+       },
        {
                .name   = "uid",
                .type   = FIO_OPT_INT,
@@ -1835,9 +1882,10 @@ static struct fio_option options[FIO_MAX_OPTS] = {
        },
 };
 
-static void add_to_lopt(struct option *lopt, struct fio_option *o)
+static void add_to_lopt(struct option *lopt, struct fio_option *o,
+                       const char *name)
 {
-       lopt->name = (char *) o->name;
+       lopt->name = (char *) name;
        lopt->val = FIO_GETOPT_JOB;
        if (o->type == FIO_OPT_STR_SET)
                lopt->has_arg = no_argument;
@@ -1858,7 +1906,11 @@ void fio_options_dup_and_init(struct option *long_options)
 
        o = &options[0];
        while (o->name) {
-               add_to_lopt(&long_options[i], o);
+               add_to_lopt(&long_options[i], o, o->name);
+               if (o->alias) {
+                       i++;
+                       add_to_lopt(&long_options[i], o, o->alias);
+               }
 
                i++;
                o++;