implement 'unit_base' option to select between KB and Kbit et. al.
[fio.git] / options.c
index 3a406fafb18e76e26bb653b178c80684db87c303..66099b58d3bd4ba4d4f2b26390e2392e4966e838 100644 (file)
--- a/options.c
+++ b/options.c
@@ -342,13 +342,8 @@ static int str_mem_cb(void *data, const char *mem)
 {
        struct thread_data *td = data;
 
-       if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
+       if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
                td->mmapfile = get_opt_postfix(mem);
-               if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
-                       log_err("fio: mmaphuge:/path/to/file\n");
-                       return 1;
-               }
-       }
 
        return 0;
 }
@@ -991,20 +986,6 @@ static int str_verify_pattern_cb(void *data, const char *input)
        return 0;
 }
 
-static int str_lockfile_cb(void *data, const char *str)
-{
-       struct thread_data *td = data;
-       char *nr = get_opt_postfix(str);
-
-       td->o.lockfile_batch = 1;
-       if (nr) {
-               td->o.lockfile_batch = atoi(nr);
-               free(nr);
-       }
-
-       return 0;
-}
-
 static int str_write_bw_log_cb(void *data, const char *str)
 {
        struct thread_data *td = data;
@@ -1119,6 +1100,25 @@ static int kb_base_verify(struct fio_option *o, void *data)
        return 0;
 }
 
+static int unit_base_verify(struct fio_option *o, void *data)
+{
+       struct thread_data *td = data;
+
+       /* 0 = default, pick based on engine
+        * 1 = use bits
+        * 8 = use bytes
+        */
+       if (td->o.unit_base != 0 &&
+               td->o.unit_base != 1 &&
+               td->o.unit_base != 8) {
+               log_err("fio: unit_base set to nonsensical value: %u\n",
+                               td->o.unit_base);
+               return 1;
+       }
+
+       return 0;
+}
+
 /*
  * Map of job/command line options
  */
@@ -1150,6 +1150,14 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .prio   = -1, /* must come after "directory" */
                .help   = "File(s) to use for the workload",
        },
+       {
+               .name   = "filename_format",
+               .type   = FIO_OPT_STR_STORE,
+               .off1   = td_var_offset(filename_format),
+               .prio   = -1, /* must come after "directory" */
+               .help   = "Override default $jobname.$jobnum.$filenum naming",
+               .def    = "$jobname.$jobnum.$filenum",
+       },
        {
                .name   = "kb_base",
                .type   = FIO_OPT_INT,
@@ -1159,10 +1167,18 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .def    = "1024",
                .help   = "How many bytes per KB for reporting (1000 or 1024)",
        },
+       {
+               .name   = "unit_base",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(unit_base),
+               .verify = unit_base_verify,
+               .prio   = 1,
+               .def    = "0",
+               .help   = "Bit multiple of result summary data (8 for byte, 1 for bit)",
+       },
        {
                .name   = "lockfile",
                .type   = FIO_OPT_STR,
-               .cb     = str_lockfile_cb,
                .off1   = td_var_offset(file_lock_mode),
                .help   = "Lock file when doing IO to it",
                .parent = "filename",
@@ -1282,12 +1298,12 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                            .help = "POSIX asynchronous IO",
                          },
 #endif
-#ifdef FIO_HAVE_SOLARISAIO
+#ifdef CONFIG_SOLARISAIO
                          { .ival = "solarisaio",
                            .help = "Solaris native asynchronous IO",
                          },
 #endif
-#ifdef FIO_HAVE_WINDOWSAIO
+#ifdef CONFIG_WINDOWSAIO
                          { .ival = "windowsaio",
                            .help = "Windows native asynchronous IO"
                          },
@@ -1337,12 +1353,12 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                            .help = "Fusion-io atomic write engine",
                          },
 #endif
-#ifdef FIO_HAVE_E4_ENG
+#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
                          { .ival = "e4defrag",
                            .help = "ext4 defrag engine",
                          },
 #endif
-#ifdef FIO_HAVE_FALLOC_ENG
+#ifdef CONFIG_LINUX_FALLOCATE
                          { .ival = "falloc",
                            .help = "fallocate() file based engine",
                          },
@@ -1583,7 +1599,7 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                },
                .parent = "nrfiles",
        },
-#ifdef FIO_HAVE_FALLOCATE
+#ifdef CONFIG_POSIX_FALLOCATE
        {
                .name   = "fallocate",
                .type   = FIO_OPT_STR,
@@ -1599,7 +1615,7 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                            .oval = FIO_FALLOCATE_POSIX,
                            .help = "Use posix_fallocate()",
                          },
-#ifdef FIO_HAVE_LINUX_FALLOCATE
+#ifdef CONFIG_LINUX_FALLOCATE
                          { .ival = "keep",
                            .oval = FIO_FALLOCATE_KEEP_SIZE,
                            .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
@@ -1616,7 +1632,7 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                          },
                },
        },
-#endif /* FIO_HAVE_FALLOCATE */
+#endif /* CONFIG_POSIX_FALLOCATE */
        {
                .name   = "fadvise_hint",
                .type   = FIO_OPT_BOOL,
@@ -1886,6 +1902,16 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .def    = "1",
                .parent = "verify",
        },
+       {
+               .name   = "verifysort_nr",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(verifysort_nr),
+               .help   = "Pre-load and sort verify blocks for a read workload",
+               .minval = 0,
+               .maxval = 131072,
+               .def    = "1024",
+               .parent = "verify",
+       },
        {
                .name   = "verify_interval",
                .type   = FIO_OPT_INT,
@@ -1956,6 +1982,12 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .parent = "verify_async",
        },
 #endif
+       {
+               .name   = "experimental_verify",
+               .off1   = td_var_offset(experimental_verify),
+               .type   = FIO_OPT_BOOL,
+               .help   = "Enable experimental verification",
+       },
 #ifdef FIO_HAVE_TRIM
        {
                .name   = "trim_percentage",
@@ -2423,8 +2455,9 @@ 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),
+               .off2   = td_var_offset(percentile_precision),
                .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,
@@ -2485,6 +2518,13 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .help   = "Set up dedicated gettimeofday() thread on this CPU",
                .verify = gtod_cpu_verify,
        },
+       {
+               .name   = "unified_rw_reporting",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(unified_rw_rep),
+               .help   = "Unify reporting across data direction",
+               .def    = "0",
+       },
        {
                .name   = "continue_on_error",
                .type   = FIO_OPT_STR,