X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=options.c;h=5bbeb34276e622cd9f1fc2f88d14664f619b8dcf;hp=3d27f2551d6b55ab76fd3c93c71036c138e3bbe6;hb=be4ecfdf6c8daa75c4df8ac875c9a87da80d81a0;hpb=182ec6ee4e4d79fc5a705cd2e2811fa003add040 diff --git a/options.c b/options.c index 3d27f255..5bbeb342 100644 --- a/options.c +++ b/options.c @@ -249,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; @@ -270,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); @@ -438,6 +461,28 @@ static int str_lockfile_cb(void *data, const char *str) 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; @@ -452,6 +497,16 @@ static int str_gtod_reduce_cb(void *data, int *il) 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; +} + #define __stringify_1(x) #x #define __stringify(x) __stringify_1(x) @@ -1266,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", }, { @@ -1341,6 +1398,12 @@ static struct fio_option options[] = { .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, },