X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=options.c;h=fb187489766205d64a15e08b7d86b7a1edb04f2e;hp=bee15cf9586af5bf9eeb9171a2606c765356bec4;hb=0539d7581388289367f77f2b800d0581ee34fb4c;hpb=44f29692cfba246981bb3c1b894333a6d2209f51 diff --git a/options.c b/options.c index bee15cf9..fb187489 100644 --- 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,30 @@ 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; + + 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; @@ -429,6 +455,7 @@ static int str_fst_cb(void *data, const char *str) return 0; } +#ifdef FIO_HAVE_SYNC_FILE_RANGE static int str_sfr_cb(void *data, const char *str) { struct thread_data *td = data; @@ -442,6 +469,7 @@ static int str_sfr_cb(void *data, const char *str) return 0; } +#endif static int check_dir(struct thread_data *td, char *fname) { @@ -1131,18 +1159,21 @@ static struct fio_option options[FIO_MAX_OPTS] = { { .ival = "wait_before", .oval = SYNC_FILE_RANGE_WAIT_BEFORE, .help = "SYNC_FILE_RANGE_WAIT_BEFORE", + .or = 1, }, { .ival = "write", .oval = SYNC_FILE_RANGE_WRITE, .help = "SYNC_FILE_RANGE_WRITE", + .or = 1, }, { .ival = "wait_after", .oval = SYNC_FILE_RANGE_WAIT_AFTER, .help = "SYNC_FILE_RANGE_WAIT_AFTER", + .or = 1, }, }, - .type = FIO_OPT_STR, + .type = FIO_OPT_STR_MULTI, .cb = str_sfr_cb, .off1 = td_var_offset(sync_file_range), .help = "Use sync_file_range()", @@ -1211,6 +1242,29 @@ static struct fio_option options[FIO_MAX_OPTS] = { .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", @@ -1261,6 +1315,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", @@ -1373,6 +1428,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", @@ -1780,6 +1849,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, @@ -1797,9 +1873,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; @@ -1820,7 +1897,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++;