X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=options.c;h=5bbeb34276e622cd9f1fc2f88d14664f619b8dcf;hp=b3986959d4884e72663b8e2467dfce8c61d526dd;hb=be4ecfdf6c8daa75c4df8ac875c9a87da80d81a0;hpb=eef323596c6c9d39456aba10954bb47c21982d96 diff --git a/options.c b/options.c index b3986959..5bbeb342 100644 --- a/options.c +++ b/options.c @@ -154,8 +154,10 @@ static int str_rw_cb(void *data, const char *str) char *nr = get_opt_postfix(str); td->o.ddir_nr = 1; - if (nr) + if (nr) { td->o.ddir_nr = atoi(nr); + free(nr); + } return 0; } @@ -247,9 +249,12 @@ static int str_cpumask_cb(void *data, unsigned int *val) CPU_ZERO(&td->o.cpumask); - for (i = 0; i < sizeof(int) * 8; i++) - if ((1 << i) & *val) + for (i = 0; i < sizeof(int) * 8; i++) { + if ((1 << i) & *val) { + dprint(FD_PARSE, "set cpu allowed %d\n", i); CPU_SET(*val, &td->o.cpumask); + } + } td->o.cpumask_set = 1; return 0; @@ -268,9 +273,29 @@ static int str_cpus_allowed_cb(void *data, const char *input) strip_blank_end(str); while ((cpu = strsep(&str, ",")) != NULL) { + char *str2, *cpu2; + int icpu, icpu2; + if (!strlen(cpu)) break; - CPU_SET(atoi(cpu), &td->o.cpumask); + + str2 = cpu; + icpu2 = -1; + while ((cpu2 = strsep(&str2, "-")) != NULL) { + if (!strlen(cpu2)) + break; + + icpu2 = atoi(cpu2); + } + + icpu = atoi(cpu); + if (icpu2 == -1) + icpu2 = icpu; + while (icpu <= icpu2) { + dprint(FD_PARSE, "set cpu allowed %d\n", icpu); + CPU_SET(atoi(cpu), &td->o.cpumask); + icpu++; + } } free(p); @@ -285,8 +310,10 @@ static int str_fst_cb(void *data, const char *str) char *nr = get_opt_postfix(str); td->file_service_nr = 1; - if (nr) + if (nr) { td->file_service_nr = atoi(nr); + free(nr); + } return 0; } @@ -426,9 +453,57 @@ static int str_lockfile_cb(void *data, const char *str) char *nr = get_opt_postfix(str); td->o.lockfile_batch = 1; - if (nr) + 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; + + if (str) + td->o.bw_log_file = strdup(str); + + td->o.write_bw_log = 1; + return 0; +} + +static int str_write_lat_log_cb(void *data, const char *str) +{ + struct thread_data *td = data; + + if (str) + td->o.lat_log_file = strdup(str); + + td->o.write_lat_log = 1; + return 0; +} + +static int str_gtod_reduce_cb(void *data, int *il) +{ + struct thread_data *td = data; + int val = *il; + + td->o.disable_clat = !!val; + td->o.disable_slat = !!val; + td->o.disable_bw = !!val; + if (val) + td->tv_cache_mask = 63; + + return 0; +} + +static int str_gtod_cpu_cb(void *data, int *il) +{ + struct thread_data *td = data; + int val = *il; + td->o.gtod_cpu = val; + td->o.gtod_offload = 1; return 0; } @@ -463,6 +538,7 @@ static struct fio_option options[] = { .type = FIO_OPT_STR_STORE, .off1 = td_var_offset(filename), .cb = str_filename_cb, + .prio = 1, /* must come before "directory" */ .help = "File(s) to use for the workload", }, { @@ -612,6 +688,7 @@ static struct fio_option options[] = { }, { .name = "iodepth_batch", + .alias = "iodepth_batch_submit", .type = FIO_OPT_INT, .off1 = td_var_offset(iodepth_batch), .help = "Number of IO to submit in one go", @@ -619,6 +696,15 @@ static struct fio_option options[] = { .minval = 1, .def = "1", }, + { + .name = "iodepth_batch_complete", + .type = FIO_OPT_INT, + .off1 = td_var_offset(iodepth_batch_complete), + .help = "Number of IO to retrieve in one go", + .parent = "iodepth", + .minval = 0, + .def = "1", + }, { .name = "iodepth_low", .type = FIO_OPT_INT, @@ -713,7 +799,7 @@ static struct fio_option options[] = { .name = "softrandommap", .type = FIO_OPT_BOOL, .off1 = td_var_offset(softrandommap), - .help = "Allow randommap to fail and continue witout", + .help = "Set norandommap if randommap allocation fails", .parent = "norandommap", .def = "0", }, @@ -820,6 +906,12 @@ static struct fio_option options[] = { .off1 = td_var_offset(time_based), .help = "Keep running until runtime/timeout is met", }, + { + .name = "ramp_time", + .type = FIO_OPT_STR_VAL_TIME, + .off1 = td_var_offset(ramp_time), + .help = "Ramp up time before measuring performance", + }, { .name = "mem", .alias = "iomem", @@ -878,6 +970,14 @@ static struct fio_option options[] = { .oval = VERIFY_CRC32, .help = "Use crc32 checksums for verification", }, + { .ival = "crc32c-intel", + .oval = VERIFY_CRC32C_INTEL, + .help = "Use hw crc32c checksums for verification", + }, + { .ival = "crc32c", + .oval = VERIFY_CRC32C, + .help = "Use crc32c checksums for verification", + }, { .ival = "crc16", .oval = VERIFY_CRC16, .help = "Use crc16 checksums for verification", @@ -1221,14 +1321,16 @@ static struct fio_option options[] = { }, { .name = "write_bw_log", - .type = FIO_OPT_STR_SET, + .type = FIO_OPT_STR, .off1 = td_var_offset(write_bw_log), + .cb = str_write_bw_log_cb, .help = "Write log of bandwidth during run", }, { .name = "write_lat_log", - .type = FIO_OPT_STR_SET, + .type = FIO_OPT_STR, .off1 = td_var_offset(write_lat_log), + .cb = str_write_lat_log_cb, .help = "Write log of latency during run", }, { @@ -1261,10 +1363,47 @@ static struct fio_option options[] = { .name = "disk_util", .type = FIO_OPT_BOOL, .off1 = td_var_offset(do_disk_util), - .help = "Log disk utilization stats", + .help = "Log disk utilization statistics", .def = "1", }, #endif + { + .name = "gtod_reduce", + .type = FIO_OPT_BOOL, + .help = "Greatly reduce number of gettimeofday() calls", + .cb = str_gtod_reduce_cb, + .def = "0", + }, + { + .name = "disable_clat", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(disable_clat), + .help = "Disable completion latency numbers", + .parent = "gtod_reduce", + .def = "0", + }, + { + .name = "disable_slat", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(disable_slat), + .help = "Disable submissionn latency numbers", + .parent = "gtod_reduce", + .def = "0", + }, + { + .name = "disable_bw_measurement", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(disable_bw), + .help = "Disable bandwidth logging", + .parent = "gtod_reduce", + .def = "0", + }, + { + .name = "gtod_cpu", + .type = FIO_OPT_INT, + .cb = str_gtod_cpu_cb, + .help = "Setup dedicated gettimeofday() thread on this CPU", + }, { .name = NULL, }, @@ -1296,9 +1435,16 @@ void fio_options_dup_and_init(struct option *long_options) } } -int fio_option_parse(struct thread_data *td, const char *opt) +int fio_options_parse(struct thread_data *td, char **opts, int num_opts) { - return parse_option(opt, options, td); + int i, ret; + + sort_options(opts, options, num_opts); + + for (ret = 0, i = 0; i < num_opts; i++) + ret |= parse_option(opts[i], options, td); + + return ret; } int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)