#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.
*/
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;
+
+ fio_clock_source = td->o.clocksource;
+ fio_time_init();
+ return 0;
+}
+
static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
{
mlock_size = *val;
return 0;
}
+#ifdef FIO_HAVE_SYNC_FILE_RANGE
static int str_sfr_cb(void *data, const char *str)
{
struct thread_data *td = data;
return 0;
}
+#endif
static int check_dir(struct thread_data *td, char *fname)
{
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;
},
{
.name = "startdelay",
- .type = FIO_OPT_INT,
+ .type = FIO_OPT_STR_VAL_TIME,
.off1 = td_var_offset(start_delay),
.help = "Only start job when this period has passed",
.def = "0",
.off1 = td_var_offset(ramp_time),
.help = "Ramp up time before measuring performance",
},
+ {
+ .name = "clocksource",
+ .type = FIO_OPT_STR,
+ .cb = fio_clock_source_cb,
+ .off1 = td_var_offset(clocksource),
+ .help = "What type of timing source to use",
+ .posval = {
+ { .ival = "gettimeofday",
+ .oval = CS_GTOD,
+ .help = "Use gettimeofday(2) for timing",
+ },
+ { .ival = "clock_gettime",
+ .oval = CS_CGETTIME,
+ .help = "Use clock_gettime(2) for timing",
+ },
+#ifdef ARCH_HAVE_CPU_CLOCK
+ { .ival = "cpu",
+ .oval = CS_CPUCLOCK,
+ .help = "Use CPU private clock",
+ },
+#endif
+ },
+ },
{
.name = "mem",
.alias = "iomem",
.type = FIO_OPT_STR,
.off1 = td_var_offset(verify),
.help = "Verify data written",
+ .cb = str_verify_cb,
.def = "0",
.posval = {
{ .ival = "0",
.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",
.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,
.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,
},
};
-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;
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++;