Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | #include <unistd.h> |
| 4 | #include <ctype.h> |
| 5 | #include <string.h> |
| 6 | #include <getopt.h> |
| 7 | #include <assert.h> |
| 8 | |
| 9 | #include "fio.h" |
| 10 | #include "parse.h" |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 11 | #include "fls.h" |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 12 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 13 | #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 14 | |
| 15 | /* |
| 16 | * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that. |
| 17 | */ |
| 18 | static char *get_opt_postfix(const char *str) |
| 19 | { |
| 20 | char *p = strstr(str, ":"); |
| 21 | |
| 22 | if (!p) |
| 23 | return NULL; |
| 24 | |
| 25 | p++; |
| 26 | strip_blank_front(&p); |
| 27 | strip_blank_end(p); |
| 28 | return strdup(p); |
| 29 | } |
| 30 | |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 31 | static int str_rw_cb(void *data, const char *str) |
| 32 | { |
| 33 | struct thread_data *td = data; |
| 34 | char *nr = get_opt_postfix(str); |
| 35 | |
Jens Axboe | fafdba3 | 2007-03-26 10:09:12 +0200 | [diff] [blame] | 36 | td->o.ddir_nr = 1; |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 37 | if (nr) |
| 38 | td->o.ddir_nr = atoi(nr); |
| 39 | |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 40 | return 0; |
| 41 | } |
| 42 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 43 | static int str_mem_cb(void *data, const char *mem) |
| 44 | { |
| 45 | struct thread_data *td = data; |
| 46 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 47 | if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 48 | td->mmapfile = get_opt_postfix(mem); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 49 | if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 50 | log_err("fio: mmaphuge:/path/to/file\n"); |
| 51 | return 1; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | static int str_lockmem_cb(void fio_unused *data, unsigned long *val) |
| 59 | { |
| 60 | mlock_size = *val; |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | #ifdef FIO_HAVE_IOPRIO |
| 65 | static int str_prioclass_cb(void *data, unsigned int *val) |
| 66 | { |
| 67 | struct thread_data *td = data; |
Jens Axboe | 6cefbe3 | 2007-04-18 12:46:56 +0200 | [diff] [blame] | 68 | unsigned short mask; |
| 69 | |
| 70 | /* |
| 71 | * mask off old class bits, str_prio_cb() may have set a default class |
| 72 | */ |
| 73 | mask = (1 << IOPRIO_CLASS_SHIFT) - 1; |
| 74 | td->ioprio &= mask; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 75 | |
| 76 | td->ioprio |= *val << IOPRIO_CLASS_SHIFT; |
| 77 | return 0; |
| 78 | } |
| 79 | |
| 80 | static int str_prio_cb(void *data, unsigned int *val) |
| 81 | { |
| 82 | struct thread_data *td = data; |
| 83 | |
| 84 | td->ioprio |= *val; |
Jens Axboe | 6cefbe3 | 2007-04-18 12:46:56 +0200 | [diff] [blame] | 85 | |
| 86 | /* |
| 87 | * If no class is set, assume BE |
| 88 | */ |
| 89 | if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0) |
| 90 | td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT; |
| 91 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 92 | return 0; |
| 93 | } |
| 94 | #endif |
| 95 | |
| 96 | static int str_exitall_cb(void) |
| 97 | { |
| 98 | exitall_on_terminate = 1; |
| 99 | return 0; |
| 100 | } |
| 101 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 102 | #ifdef FIO_HAVE_CPU_AFFINITY |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 103 | static int str_cpumask_cb(void *data, unsigned int *val) |
| 104 | { |
| 105 | struct thread_data *td = data; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 106 | unsigned int i; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 107 | |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 108 | CPU_ZERO(&td->o.cpumask); |
| 109 | |
| 110 | for (i = 0; i < sizeof(int) * 8; i++) |
| 111 | if ((1 << i) & *val) |
| 112 | CPU_SET(*val, &td->o.cpumask); |
| 113 | |
Jens Axboe | 375b269 | 2007-05-22 09:13:02 +0200 | [diff] [blame] | 114 | td->o.cpumask_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 115 | return 0; |
| 116 | } |
| 117 | |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 118 | static int str_cpus_allowed_cb(void *data, const char *input) |
| 119 | { |
| 120 | struct thread_data *td = data; |
| 121 | char *cpu, *str, *p; |
| 122 | |
| 123 | CPU_ZERO(&td->o.cpumask); |
| 124 | |
| 125 | p = str = strdup(input); |
| 126 | |
| 127 | strip_blank_front(&str); |
| 128 | strip_blank_end(str); |
| 129 | |
| 130 | while ((cpu = strsep(&str, ",")) != NULL) { |
| 131 | if (!strlen(cpu)) |
| 132 | break; |
| 133 | CPU_SET(atoi(cpu), &td->o.cpumask); |
| 134 | } |
| 135 | |
| 136 | free(p); |
| 137 | td->o.cpumask_set = 1; |
| 138 | exit(0); |
| 139 | return 0; |
| 140 | } |
| 141 | #endif |
| 142 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 143 | static int str_fst_cb(void *data, const char *str) |
| 144 | { |
| 145 | struct thread_data *td = data; |
| 146 | char *nr = get_opt_postfix(str); |
| 147 | |
| 148 | td->file_service_nr = 1; |
| 149 | if (nr) |
| 150 | td->file_service_nr = atoi(nr); |
| 151 | |
| 152 | return 0; |
| 153 | } |
| 154 | |
| 155 | static int str_filename_cb(void *data, const char *input) |
| 156 | { |
| 157 | struct thread_data *td = data; |
| 158 | char *fname, *str, *p; |
| 159 | |
| 160 | p = str = strdup(input); |
| 161 | |
| 162 | strip_blank_front(&str); |
| 163 | strip_blank_end(str); |
| 164 | |
| 165 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 166 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 167 | |
| 168 | while ((fname = strsep(&str, ":")) != NULL) { |
| 169 | if (!strlen(fname)) |
| 170 | break; |
| 171 | add_file(td, fname); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 172 | td->o.nr_files++; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | free(p); |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | static int str_directory_cb(void *data, const char fio_unused *str) |
| 180 | { |
| 181 | struct thread_data *td = data; |
| 182 | struct stat sb; |
| 183 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 184 | if (lstat(td->o.directory, &sb) < 0) { |
| 185 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 186 | td_verror(td, errno, "lstat"); |
| 187 | return 1; |
| 188 | } |
| 189 | if (!S_ISDIR(sb.st_mode)) { |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 190 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 191 | return 1; |
| 192 | } |
| 193 | |
| 194 | return 0; |
| 195 | } |
| 196 | |
| 197 | static int str_opendir_cb(void *data, const char fio_unused *str) |
| 198 | { |
| 199 | struct thread_data *td = data; |
| 200 | |
| 201 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 202 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 203 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 204 | return add_dir_files(td, td->o.opendir); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 205 | } |
| 206 | |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 207 | static int str_verify_offset_cb(void *data, unsigned int *off) |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 208 | { |
| 209 | struct thread_data *td = data; |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 210 | |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 211 | if (*off && *off < sizeof(struct verify_header)) { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 212 | log_err("fio: verify_offset too small\n"); |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 213 | return 1; |
| 214 | } |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 215 | |
| 216 | td->o.verify_offset = *off; |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 217 | return 0; |
| 218 | } |
| 219 | |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 220 | static int str_verify_pattern_cb(void *data, unsigned int *off) |
| 221 | { |
| 222 | struct thread_data *td = data; |
| 223 | unsigned int msb; |
| 224 | |
| 225 | msb = fls(*off); |
| 226 | if (msb <= 8) |
| 227 | td->o.verify_pattern_bytes = 1; |
| 228 | else if (msb <= 16) |
| 229 | td->o.verify_pattern_bytes = 2; |
| 230 | else if (msb <= 24) |
| 231 | td->o.verify_pattern_bytes = 3; |
| 232 | else |
| 233 | td->o.verify_pattern_bytes = 4; |
| 234 | |
| 235 | td->o.verify_pattern = *off; |
| 236 | return 0; |
| 237 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 238 | |
| 239 | #define __stringify_1(x) #x |
| 240 | #define __stringify(x) __stringify_1(x) |
| 241 | |
| 242 | /* |
| 243 | * Map of job/command line options |
| 244 | */ |
| 245 | static struct fio_option options[] = { |
| 246 | { |
| 247 | .name = "description", |
| 248 | .type = FIO_OPT_STR_STORE, |
| 249 | .off1 = td_var_offset(description), |
| 250 | .help = "Text job description", |
| 251 | }, |
| 252 | { |
| 253 | .name = "name", |
| 254 | .type = FIO_OPT_STR_STORE, |
| 255 | .off1 = td_var_offset(name), |
| 256 | .help = "Name of this job", |
| 257 | }, |
| 258 | { |
| 259 | .name = "directory", |
| 260 | .type = FIO_OPT_STR_STORE, |
| 261 | .off1 = td_var_offset(directory), |
| 262 | .cb = str_directory_cb, |
| 263 | .help = "Directory to store files in", |
| 264 | }, |
| 265 | { |
| 266 | .name = "filename", |
| 267 | .type = FIO_OPT_STR_STORE, |
| 268 | .off1 = td_var_offset(filename), |
| 269 | .cb = str_filename_cb, |
| 270 | .help = "File(s) to use for the workload", |
| 271 | }, |
| 272 | { |
| 273 | .name = "opendir", |
| 274 | .type = FIO_OPT_STR_STORE, |
| 275 | .off1 = td_var_offset(opendir), |
| 276 | .cb = str_opendir_cb, |
| 277 | .help = "Recursively add files from this directory and down", |
| 278 | }, |
| 279 | { |
| 280 | .name = "rw", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 281 | .alias = "readwrite", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 282 | .type = FIO_OPT_STR, |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 283 | .cb = str_rw_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 284 | .off1 = td_var_offset(td_ddir), |
| 285 | .help = "IO direction", |
| 286 | .def = "read", |
| 287 | .posval = { |
| 288 | { .ival = "read", |
| 289 | .oval = TD_DDIR_READ, |
| 290 | .help = "Sequential read", |
| 291 | }, |
| 292 | { .ival = "write", |
| 293 | .oval = TD_DDIR_WRITE, |
| 294 | .help = "Sequential write", |
| 295 | }, |
| 296 | { .ival = "randread", |
| 297 | .oval = TD_DDIR_RANDREAD, |
| 298 | .help = "Random read", |
| 299 | }, |
| 300 | { .ival = "randwrite", |
| 301 | .oval = TD_DDIR_RANDWRITE, |
| 302 | .help = "Random write", |
| 303 | }, |
| 304 | { .ival = "rw", |
| 305 | .oval = TD_DDIR_RW, |
| 306 | .help = "Sequential read and write mix", |
| 307 | }, |
| 308 | { .ival = "randrw", |
| 309 | .oval = TD_DDIR_RANDRW, |
| 310 | .help = "Random read and write mix" |
| 311 | }, |
| 312 | }, |
| 313 | }, |
| 314 | { |
Jens Axboe | d2f3ac3 | 2007-03-22 19:24:09 +0100 | [diff] [blame] | 315 | .name = "fadvise_hint", |
| 316 | .type = FIO_OPT_BOOL, |
| 317 | .off1 = td_var_offset(fadvise_hint), |
| 318 | .help = "Use fadvise() to advise the kernel on IO pattern", |
| 319 | .def = "1", |
| 320 | }, |
| 321 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 322 | .name = "ioengine", |
| 323 | .type = FIO_OPT_STR_STORE, |
| 324 | .off1 = td_var_offset(ioengine), |
| 325 | .help = "IO engine to use", |
| 326 | .def = "sync", |
| 327 | .posval = { |
| 328 | { .ival = "sync", |
| 329 | .help = "Use read/write", |
| 330 | }, |
| 331 | #ifdef FIO_HAVE_LIBAIO |
| 332 | { .ival = "libaio", |
| 333 | .help = "Linux native asynchronous IO", |
| 334 | }, |
| 335 | #endif |
| 336 | #ifdef FIO_HAVE_POSIXAIO |
| 337 | { .ival = "posixaio", |
| 338 | .help = "POSIX asynchronous IO", |
| 339 | }, |
| 340 | #endif |
| 341 | { .ival = "mmap", |
| 342 | .help = "Memory mapped IO", |
| 343 | }, |
| 344 | #ifdef FIO_HAVE_SPLICE |
| 345 | { .ival = "splice", |
| 346 | .help = "splice/vmsplice based IO", |
| 347 | }, |
Jens Axboe | 9cce02e | 2007-06-22 15:42:21 +0200 | [diff] [blame] | 348 | { .ival = "netsplice", |
| 349 | .help = "splice/vmsplice to/from the network", |
| 350 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 351 | #endif |
| 352 | #ifdef FIO_HAVE_SGIO |
| 353 | { .ival = "sg", |
| 354 | .help = "SCSI generic v3 IO", |
| 355 | }, |
| 356 | #endif |
| 357 | { .ival = "null", |
| 358 | .help = "Testing engine (no data transfer)", |
| 359 | }, |
| 360 | { .ival = "net", |
| 361 | .help = "Network IO", |
| 362 | }, |
| 363 | #ifdef FIO_HAVE_SYSLET |
| 364 | { .ival = "syslet-rw", |
| 365 | .help = "syslet enabled async pread/pwrite IO", |
| 366 | }, |
| 367 | #endif |
| 368 | { .ival = "cpuio", |
| 369 | .help = "CPU cycler burner engine", |
| 370 | }, |
Jens Axboe | b8c82a4 | 2007-03-21 08:48:26 +0100 | [diff] [blame] | 371 | #ifdef FIO_HAVE_GUASI |
| 372 | { .ival = "guasi", |
| 373 | .help = "GUASI IO engine", |
| 374 | }, |
| 375 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 376 | { .ival = "external", |
| 377 | .help = "Load external engine (append name)", |
| 378 | }, |
| 379 | }, |
| 380 | }, |
| 381 | { |
| 382 | .name = "iodepth", |
| 383 | .type = FIO_OPT_INT, |
| 384 | .off1 = td_var_offset(iodepth), |
| 385 | .help = "Amount of IO buffers to keep in flight", |
| 386 | .def = "1", |
| 387 | }, |
| 388 | { |
| 389 | .name = "iodepth_batch", |
| 390 | .type = FIO_OPT_INT, |
| 391 | .off1 = td_var_offset(iodepth_batch), |
| 392 | .help = "Number of IO to submit in one go", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 393 | .parent = "iodepth", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 394 | }, |
| 395 | { |
| 396 | .name = "iodepth_low", |
| 397 | .type = FIO_OPT_INT, |
| 398 | .off1 = td_var_offset(iodepth_low), |
| 399 | .help = "Low water mark for queuing depth", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 400 | .parent = "iodepth", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 401 | }, |
| 402 | { |
| 403 | .name = "size", |
| 404 | .type = FIO_OPT_STR_VAL, |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 405 | .off1 = td_var_offset(size), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 406 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 407 | .help = "Total size of device or files", |
| 408 | }, |
| 409 | { |
| 410 | .name = "filesize", |
| 411 | .type = FIO_OPT_STR_VAL, |
| 412 | .off1 = td_var_offset(file_size_low), |
| 413 | .off2 = td_var_offset(file_size_high), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 414 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 415 | .help = "Size of individual files", |
| 416 | }, |
| 417 | { |
| 418 | .name = "bs", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 419 | .alias = "blocksize", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 420 | .type = FIO_OPT_STR_VAL_INT, |
| 421 | .off1 = td_var_offset(bs[DDIR_READ]), |
| 422 | .off2 = td_var_offset(bs[DDIR_WRITE]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 423 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 424 | .help = "Block size unit", |
| 425 | .def = "4k", |
| 426 | }, |
| 427 | { |
| 428 | .name = "bsrange", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 429 | .alias = "blocksize_range", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 430 | .type = FIO_OPT_RANGE, |
| 431 | .off1 = td_var_offset(min_bs[DDIR_READ]), |
| 432 | .off2 = td_var_offset(max_bs[DDIR_READ]), |
| 433 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), |
| 434 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 435 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 436 | .help = "Set block size range (in more detail than bs)", |
| 437 | }, |
| 438 | { |
| 439 | .name = "bs_unaligned", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 440 | .alias = "blocksize_unaligned", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 441 | .type = FIO_OPT_STR_SET, |
| 442 | .off1 = td_var_offset(bs_unaligned), |
| 443 | .help = "Don't sector align IO buffer sizes", |
| 444 | }, |
| 445 | { |
| 446 | .name = "offset", |
| 447 | .type = FIO_OPT_STR_VAL, |
| 448 | .off1 = td_var_offset(start_offset), |
| 449 | .help = "Start IO from this offset", |
| 450 | .def = "0", |
| 451 | }, |
| 452 | { |
| 453 | .name = "randrepeat", |
| 454 | .type = FIO_OPT_BOOL, |
| 455 | .off1 = td_var_offset(rand_repeatable), |
| 456 | .help = "Use repeatable random IO pattern", |
| 457 | .def = "1", |
| 458 | }, |
| 459 | { |
| 460 | .name = "norandommap", |
| 461 | .type = FIO_OPT_STR_SET, |
| 462 | .off1 = td_var_offset(norandommap), |
| 463 | .help = "Accept potential duplicate random blocks", |
| 464 | }, |
| 465 | { |
| 466 | .name = "nrfiles", |
| 467 | .type = FIO_OPT_INT, |
| 468 | .off1 = td_var_offset(nr_files), |
| 469 | .help = "Split job workload between this number of files", |
| 470 | .def = "1", |
| 471 | }, |
| 472 | { |
| 473 | .name = "openfiles", |
| 474 | .type = FIO_OPT_INT, |
| 475 | .off1 = td_var_offset(open_files), |
| 476 | .help = "Number of files to keep open at the same time", |
| 477 | }, |
| 478 | { |
| 479 | .name = "file_service_type", |
| 480 | .type = FIO_OPT_STR, |
| 481 | .cb = str_fst_cb, |
| 482 | .off1 = td_var_offset(file_service_type), |
| 483 | .help = "How to select which file to service next", |
| 484 | .def = "roundrobin", |
| 485 | .posval = { |
| 486 | { .ival = "random", |
| 487 | .oval = FIO_FSERVICE_RANDOM, |
| 488 | .help = "Choose a file at random", |
| 489 | }, |
| 490 | { .ival = "roundrobin", |
| 491 | .oval = FIO_FSERVICE_RR, |
| 492 | .help = "Round robin select files", |
| 493 | }, |
| 494 | }, |
| 495 | }, |
| 496 | { |
| 497 | .name = "fsync", |
| 498 | .type = FIO_OPT_INT, |
| 499 | .off1 = td_var_offset(fsync_blocks), |
| 500 | .help = "Issue fsync for writes every given number of blocks", |
| 501 | .def = "0", |
| 502 | }, |
| 503 | { |
| 504 | .name = "direct", |
| 505 | .type = FIO_OPT_BOOL, |
| 506 | .off1 = td_var_offset(odirect), |
| 507 | .help = "Use O_DIRECT IO (negates buffered)", |
| 508 | .def = "0", |
| 509 | }, |
| 510 | { |
| 511 | .name = "buffered", |
| 512 | .type = FIO_OPT_BOOL, |
| 513 | .off1 = td_var_offset(odirect), |
| 514 | .neg = 1, |
| 515 | .help = "Use buffered IO (negates direct)", |
| 516 | .def = "1", |
| 517 | }, |
| 518 | { |
| 519 | .name = "overwrite", |
| 520 | .type = FIO_OPT_BOOL, |
| 521 | .off1 = td_var_offset(overwrite), |
| 522 | .help = "When writing, set whether to overwrite current data", |
| 523 | .def = "0", |
| 524 | }, |
| 525 | { |
| 526 | .name = "loops", |
| 527 | .type = FIO_OPT_INT, |
| 528 | .off1 = td_var_offset(loops), |
| 529 | .help = "Number of times to run the job", |
| 530 | .def = "1", |
| 531 | }, |
| 532 | { |
| 533 | .name = "numjobs", |
| 534 | .type = FIO_OPT_INT, |
| 535 | .off1 = td_var_offset(numjobs), |
| 536 | .help = "Duplicate this job this many times", |
| 537 | .def = "1", |
| 538 | }, |
| 539 | { |
| 540 | .name = "startdelay", |
| 541 | .type = FIO_OPT_INT, |
| 542 | .off1 = td_var_offset(start_delay), |
| 543 | .help = "Only start job when this period has passed", |
| 544 | .def = "0", |
| 545 | }, |
| 546 | { |
| 547 | .name = "runtime", |
| 548 | .alias = "timeout", |
| 549 | .type = FIO_OPT_STR_VAL_TIME, |
| 550 | .off1 = td_var_offset(timeout), |
| 551 | .help = "Stop workload when this amount of time has passed", |
| 552 | .def = "0", |
| 553 | }, |
| 554 | { |
Jens Axboe | cf4464c | 2007-04-17 20:14:42 +0200 | [diff] [blame] | 555 | .name = "time_based", |
| 556 | .type = FIO_OPT_STR_SET, |
| 557 | .off1 = td_var_offset(time_based), |
| 558 | .help = "Keep running until runtime/timeout is met", |
| 559 | }, |
| 560 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 561 | .name = "mem", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 562 | .alias = "iomem", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 563 | .type = FIO_OPT_STR, |
| 564 | .cb = str_mem_cb, |
| 565 | .off1 = td_var_offset(mem_type), |
| 566 | .help = "Backing type for IO buffers", |
| 567 | .def = "malloc", |
| 568 | .posval = { |
| 569 | { .ival = "malloc", |
| 570 | .oval = MEM_MALLOC, |
| 571 | .help = "Use malloc(3) for IO buffers", |
| 572 | }, |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 573 | { .ival = "shm", |
| 574 | .oval = MEM_SHM, |
| 575 | .help = "Use shared memory segments for IO buffers", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 576 | }, |
| 577 | #ifdef FIO_HAVE_HUGETLB |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 578 | { .ival = "shmhuge", |
| 579 | .oval = MEM_SHMHUGE, |
| 580 | .help = "Like shm, but use huge pages", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 581 | }, |
| 582 | #endif |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 583 | { .ival = "mmap", |
| 584 | .oval = MEM_MMAP, |
| 585 | .help = "Use mmap(2) (file or anon) for IO buffers", |
| 586 | }, |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 587 | #ifdef FIO_HAVE_HUGETLB |
| 588 | { .ival = "mmaphuge", |
| 589 | .oval = MEM_MMAPHUGE, |
| 590 | .help = "Like mmap, but use huge pages", |
| 591 | }, |
| 592 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 593 | }, |
| 594 | }, |
| 595 | { |
| 596 | .name = "verify", |
| 597 | .type = FIO_OPT_STR, |
| 598 | .off1 = td_var_offset(verify), |
| 599 | .help = "Verify data written", |
| 600 | .def = "0", |
| 601 | .posval = { |
| 602 | { .ival = "0", |
| 603 | .oval = VERIFY_NONE, |
| 604 | .help = "Don't do IO verification", |
| 605 | }, |
Jens Axboe | fcca4b5 | 2007-07-27 15:42:00 +0200 | [diff] [blame] | 606 | { .ival = "md5", |
| 607 | .oval = VERIFY_MD5, |
| 608 | .help = "Use md5 checksums for verification", |
| 609 | }, |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 610 | { .ival = "crc64", |
| 611 | .oval = VERIFY_CRC64, |
| 612 | .help = "Use crc64 checksums for verification", |
| 613 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 614 | { .ival = "crc32", |
| 615 | .oval = VERIFY_CRC32, |
| 616 | .help = "Use crc32 checksums for verification", |
| 617 | }, |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 618 | { .ival = "crc16", |
| 619 | .oval = VERIFY_CRC16, |
| 620 | .help = "Use crc16 checksums for verification", |
| 621 | }, |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 622 | { .ival = "crc7", |
| 623 | .oval = VERIFY_CRC7, |
| 624 | .help = "Use crc7 checksums for verification", |
| 625 | }, |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 626 | { .ival = "sha256", |
| 627 | .oval = VERIFY_SHA256, |
| 628 | .help = "Use sha256 checksums for verification", |
| 629 | }, |
| 630 | { .ival = "sha512", |
| 631 | .oval = VERIFY_SHA512, |
| 632 | .help = "Use sha512 checksums for verification", |
| 633 | }, |
Jens Axboe | 36690c9 | 2007-03-26 10:23:34 +0200 | [diff] [blame] | 634 | { |
| 635 | .ival = "null", |
| 636 | .oval = VERIFY_NULL, |
| 637 | .help = "Pretend to verify", |
| 638 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 639 | }, |
| 640 | }, |
| 641 | { |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 642 | .name = "verifysort", |
| 643 | .type = FIO_OPT_BOOL, |
| 644 | .off1 = td_var_offset(verifysort), |
| 645 | .help = "Sort written verify blocks for read back", |
| 646 | .def = "1", |
| 647 | }, |
| 648 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 649 | .name = "verify_interval", |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 650 | .type = FIO_OPT_STR_VAL_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 651 | .off1 = td_var_offset(verify_interval), |
Jens Axboe | 819a968 | 2007-07-28 21:30:31 +0200 | [diff] [blame] | 652 | .minval = 2 * sizeof(struct verify_header), |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 653 | .help = "Store verify buffer header every N bytes", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 654 | .parent = "verify", |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 655 | }, |
| 656 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 657 | .name = "verify_offset", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 658 | .type = FIO_OPT_STR_VAL_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 659 | .help = "Offset verify header location by N bytes", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 660 | .def = "0", |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 661 | .cb = str_verify_offset_cb, |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 662 | .parent = "verify", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 663 | }, |
| 664 | { |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 665 | .name = "verify_pattern", |
| 666 | .type = FIO_OPT_INT, |
| 667 | .cb = str_verify_pattern_cb, |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 668 | .help = "Fill pattern for IO buffers", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 669 | .parent = "verify", |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 670 | }, |
| 671 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 672 | .name = "write_iolog", |
| 673 | .type = FIO_OPT_STR_STORE, |
| 674 | .off1 = td_var_offset(write_iolog_file), |
| 675 | .help = "Store IO pattern to file", |
| 676 | }, |
| 677 | { |
| 678 | .name = "read_iolog", |
| 679 | .type = FIO_OPT_STR_STORE, |
| 680 | .off1 = td_var_offset(read_iolog_file), |
| 681 | .help = "Playback IO pattern from file", |
| 682 | }, |
| 683 | { |
| 684 | .name = "exec_prerun", |
| 685 | .type = FIO_OPT_STR_STORE, |
| 686 | .off1 = td_var_offset(exec_prerun), |
| 687 | .help = "Execute this file prior to running job", |
| 688 | }, |
| 689 | { |
| 690 | .name = "exec_postrun", |
| 691 | .type = FIO_OPT_STR_STORE, |
| 692 | .off1 = td_var_offset(exec_postrun), |
| 693 | .help = "Execute this file after running job", |
| 694 | }, |
| 695 | #ifdef FIO_HAVE_IOSCHED_SWITCH |
| 696 | { |
| 697 | .name = "ioscheduler", |
| 698 | .type = FIO_OPT_STR_STORE, |
| 699 | .off1 = td_var_offset(ioscheduler), |
| 700 | .help = "Use this IO scheduler on the backing device", |
| 701 | }, |
| 702 | #endif |
| 703 | { |
| 704 | .name = "zonesize", |
| 705 | .type = FIO_OPT_STR_VAL, |
| 706 | .off1 = td_var_offset(zone_size), |
| 707 | .help = "Give size of an IO zone", |
| 708 | .def = "0", |
| 709 | }, |
| 710 | { |
| 711 | .name = "zoneskip", |
| 712 | .type = FIO_OPT_STR_VAL, |
| 713 | .off1 = td_var_offset(zone_skip), |
| 714 | .help = "Space between IO zones", |
| 715 | .def = "0", |
| 716 | }, |
| 717 | { |
| 718 | .name = "lockmem", |
| 719 | .type = FIO_OPT_STR_VAL, |
| 720 | .cb = str_lockmem_cb, |
| 721 | .help = "Lock down this amount of memory", |
| 722 | .def = "0", |
| 723 | }, |
| 724 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 725 | .name = "rwmixread", |
| 726 | .type = FIO_OPT_INT, |
Jens Axboe | e47f799 | 2007-03-21 14:05:39 +0100 | [diff] [blame] | 727 | .off1 = td_var_offset(rwmix[DDIR_READ]), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 728 | .maxval = 100, |
| 729 | .help = "Percentage of mixed workload that is reads", |
| 730 | .def = "50", |
| 731 | }, |
| 732 | { |
| 733 | .name = "rwmixwrite", |
| 734 | .type = FIO_OPT_INT, |
Jens Axboe | e47f799 | 2007-03-21 14:05:39 +0100 | [diff] [blame] | 735 | .off1 = td_var_offset(rwmix[DDIR_WRITE]), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 736 | .maxval = 100, |
| 737 | .help = "Percentage of mixed workload that is writes", |
| 738 | .def = "50", |
| 739 | }, |
| 740 | { |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 741 | .name = "rwmixcycle", |
| 742 | .type = FIO_OPT_INT, |
| 743 | .off1 = td_var_offset(rwmixcycle), |
| 744 | .help = "Cycle period for mixed read/write workloads (msec)", |
| 745 | .def = "500", |
| 746 | .parent = "rwmixread", |
| 747 | }, |
| 748 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 749 | .name = "nice", |
| 750 | .type = FIO_OPT_INT, |
| 751 | .off1 = td_var_offset(nice), |
| 752 | .help = "Set job CPU nice value", |
| 753 | .minval = -19, |
| 754 | .maxval = 20, |
| 755 | .def = "0", |
| 756 | }, |
| 757 | #ifdef FIO_HAVE_IOPRIO |
| 758 | { |
| 759 | .name = "prio", |
| 760 | .type = FIO_OPT_INT, |
| 761 | .cb = str_prio_cb, |
| 762 | .help = "Set job IO priority value", |
| 763 | .minval = 0, |
| 764 | .maxval = 7, |
| 765 | }, |
| 766 | { |
| 767 | .name = "prioclass", |
| 768 | .type = FIO_OPT_INT, |
| 769 | .cb = str_prioclass_cb, |
| 770 | .help = "Set job IO priority class", |
| 771 | .minval = 0, |
| 772 | .maxval = 3, |
| 773 | }, |
| 774 | #endif |
| 775 | { |
| 776 | .name = "thinktime", |
| 777 | .type = FIO_OPT_INT, |
| 778 | .off1 = td_var_offset(thinktime), |
| 779 | .help = "Idle time between IO buffers (usec)", |
| 780 | .def = "0", |
| 781 | }, |
| 782 | { |
| 783 | .name = "thinktime_spin", |
| 784 | .type = FIO_OPT_INT, |
| 785 | .off1 = td_var_offset(thinktime_spin), |
| 786 | .help = "Start think time by spinning this amount (usec)", |
| 787 | .def = "0", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 788 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 789 | }, |
| 790 | { |
| 791 | .name = "thinktime_blocks", |
| 792 | .type = FIO_OPT_INT, |
| 793 | .off1 = td_var_offset(thinktime_blocks), |
| 794 | .help = "IO buffer period between 'thinktime'", |
| 795 | .def = "1", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 796 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 797 | }, |
| 798 | { |
| 799 | .name = "rate", |
| 800 | .type = FIO_OPT_INT, |
| 801 | .off1 = td_var_offset(rate), |
| 802 | .help = "Set bandwidth rate", |
| 803 | }, |
| 804 | { |
| 805 | .name = "ratemin", |
| 806 | .type = FIO_OPT_INT, |
| 807 | .off1 = td_var_offset(ratemin), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 808 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 809 | .parent = "rate", |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 810 | }, |
| 811 | { |
| 812 | .name = "rate_iops", |
| 813 | .type = FIO_OPT_INT, |
| 814 | .off1 = td_var_offset(rate_iops), |
| 815 | .help = "Limit IO used to this number of IO operations/sec", |
| 816 | }, |
| 817 | { |
| 818 | .name = "rate_iops_min", |
| 819 | .type = FIO_OPT_INT, |
| 820 | .off1 = td_var_offset(rate_iops_min), |
| 821 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 822 | .parent = "rate_iops", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 823 | }, |
| 824 | { |
| 825 | .name = "ratecycle", |
| 826 | .type = FIO_OPT_INT, |
| 827 | .off1 = td_var_offset(ratecycle), |
| 828 | .help = "Window average for rate limits (msec)", |
| 829 | .def = "1000", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame^] | 830 | .parent = "rate", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 831 | }, |
| 832 | { |
| 833 | .name = "invalidate", |
| 834 | .type = FIO_OPT_BOOL, |
| 835 | .off1 = td_var_offset(invalidate_cache), |
| 836 | .help = "Invalidate buffer/page cache prior to running job", |
| 837 | .def = "1", |
| 838 | }, |
| 839 | { |
| 840 | .name = "sync", |
| 841 | .type = FIO_OPT_BOOL, |
| 842 | .off1 = td_var_offset(sync_io), |
| 843 | .help = "Use O_SYNC for buffered writes", |
| 844 | .def = "0", |
| 845 | }, |
| 846 | { |
| 847 | .name = "bwavgtime", |
| 848 | .type = FIO_OPT_INT, |
| 849 | .off1 = td_var_offset(bw_avg_time), |
| 850 | .help = "Time window over which to calculate bandwidth (msec)", |
| 851 | .def = "500", |
| 852 | }, |
| 853 | { |
| 854 | .name = "create_serialize", |
| 855 | .type = FIO_OPT_BOOL, |
| 856 | .off1 = td_var_offset(create_serialize), |
| 857 | .help = "Serialize creating of job files", |
| 858 | .def = "1", |
| 859 | }, |
| 860 | { |
| 861 | .name = "create_fsync", |
| 862 | .type = FIO_OPT_BOOL, |
| 863 | .off1 = td_var_offset(create_fsync), |
| 864 | .help = "Fsync file after creation", |
| 865 | .def = "1", |
| 866 | }, |
| 867 | { |
| 868 | .name = "cpuload", |
| 869 | .type = FIO_OPT_INT, |
| 870 | .off1 = td_var_offset(cpuload), |
| 871 | .help = "Use this percentage of CPU", |
| 872 | }, |
| 873 | { |
| 874 | .name = "cpuchunks", |
| 875 | .type = FIO_OPT_INT, |
| 876 | .off1 = td_var_offset(cpucycle), |
| 877 | .help = "Length of the CPU burn cycles (usecs)", |
| 878 | .def = "50000", |
| 879 | }, |
| 880 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 881 | { |
| 882 | .name = "cpumask", |
| 883 | .type = FIO_OPT_INT, |
| 884 | .cb = str_cpumask_cb, |
| 885 | .help = "CPU affinity mask", |
| 886 | }, |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 887 | { |
| 888 | .name = "cpus_allowed", |
| 889 | .type = FIO_OPT_STR, |
| 890 | .cb = str_cpus_allowed_cb, |
| 891 | .help = "Set CPUs allowed", |
| 892 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 893 | #endif |
| 894 | { |
| 895 | .name = "end_fsync", |
| 896 | .type = FIO_OPT_BOOL, |
| 897 | .off1 = td_var_offset(end_fsync), |
| 898 | .help = "Include fsync at the end of job", |
| 899 | .def = "0", |
| 900 | }, |
| 901 | { |
| 902 | .name = "fsync_on_close", |
| 903 | .type = FIO_OPT_BOOL, |
| 904 | .off1 = td_var_offset(fsync_on_close), |
| 905 | .help = "fsync files on close", |
| 906 | .def = "0", |
| 907 | }, |
| 908 | { |
| 909 | .name = "unlink", |
| 910 | .type = FIO_OPT_BOOL, |
| 911 | .off1 = td_var_offset(unlink), |
| 912 | .help = "Unlink created files after job has completed", |
| 913 | .def = "0", |
| 914 | }, |
| 915 | { |
| 916 | .name = "exitall", |
| 917 | .type = FIO_OPT_STR_SET, |
| 918 | .cb = str_exitall_cb, |
| 919 | .help = "Terminate all jobs when one exits", |
| 920 | }, |
| 921 | { |
| 922 | .name = "stonewall", |
| 923 | .type = FIO_OPT_STR_SET, |
| 924 | .off1 = td_var_offset(stonewall), |
| 925 | .help = "Insert a hard barrier between this job and previous", |
| 926 | }, |
| 927 | { |
Jens Axboe | b3d62a7 | 2007-03-20 14:23:26 +0100 | [diff] [blame] | 928 | .name = "new_group", |
| 929 | .type = FIO_OPT_STR_SET, |
| 930 | .off1 = td_var_offset(new_group), |
| 931 | .help = "Mark the start of a new group (for reporting)", |
| 932 | }, |
| 933 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 934 | .name = "thread", |
| 935 | .type = FIO_OPT_STR_SET, |
| 936 | .off1 = td_var_offset(use_thread), |
| 937 | .help = "Use threads instead of forks", |
| 938 | }, |
| 939 | { |
| 940 | .name = "write_bw_log", |
| 941 | .type = FIO_OPT_STR_SET, |
| 942 | .off1 = td_var_offset(write_bw_log), |
| 943 | .help = "Write log of bandwidth during run", |
| 944 | }, |
| 945 | { |
| 946 | .name = "write_lat_log", |
| 947 | .type = FIO_OPT_STR_SET, |
| 948 | .off1 = td_var_offset(write_lat_log), |
| 949 | .help = "Write log of latency during run", |
| 950 | }, |
| 951 | { |
| 952 | .name = "hugepage-size", |
| 953 | .type = FIO_OPT_STR_VAL, |
| 954 | .off1 = td_var_offset(hugepage_size), |
| 955 | .help = "When using hugepages, specify size of each page", |
| 956 | .def = __stringify(FIO_HUGE_PAGE), |
| 957 | }, |
| 958 | { |
| 959 | .name = "group_reporting", |
| 960 | .type = FIO_OPT_STR_SET, |
| 961 | .off1 = td_var_offset(group_reporting), |
| 962 | .help = "Do reporting on a per-group basis", |
| 963 | }, |
| 964 | { |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 965 | .name = "zero_buffers", |
| 966 | .type = FIO_OPT_STR_SET, |
| 967 | .off1 = td_var_offset(zero_buffers), |
| 968 | .help = "Init IO buffers to all zeroes", |
| 969 | }, |
Jens Axboe | 0a839f3 | 2007-04-26 09:02:34 +0200 | [diff] [blame] | 970 | #ifdef FIO_HAVE_DISK_UTIL |
| 971 | { |
| 972 | .name = "disk_util", |
| 973 | .type = FIO_OPT_BOOL, |
| 974 | .off1 = td_var_offset(do_disk_util), |
| 975 | .help = "Log disk utilization stats", |
| 976 | .def = "1", |
| 977 | }, |
| 978 | #endif |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 979 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 980 | .name = NULL, |
| 981 | }, |
| 982 | }; |
| 983 | |
| 984 | void fio_options_dup_and_init(struct option *long_options) |
| 985 | { |
| 986 | struct fio_option *o; |
| 987 | unsigned int i; |
| 988 | |
| 989 | options_init(options); |
| 990 | |
| 991 | i = 0; |
| 992 | while (long_options[i].name) |
| 993 | i++; |
| 994 | |
| 995 | o = &options[0]; |
| 996 | while (o->name) { |
| 997 | long_options[i].name = o->name; |
| 998 | long_options[i].val = FIO_GETOPT_JOB; |
| 999 | if (o->type == FIO_OPT_STR_SET) |
| 1000 | long_options[i].has_arg = no_argument; |
| 1001 | else |
| 1002 | long_options[i].has_arg = required_argument; |
| 1003 | |
| 1004 | i++; |
| 1005 | o++; |
| 1006 | assert(i < FIO_NR_OPTIONS); |
| 1007 | } |
| 1008 | } |
| 1009 | |
| 1010 | int fio_option_parse(struct thread_data *td, const char *opt) |
| 1011 | { |
| 1012 | return parse_option(opt, options, td); |
| 1013 | } |
| 1014 | |
| 1015 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) |
| 1016 | { |
| 1017 | return parse_cmd_option(opt, val, options, td); |
| 1018 | } |
| 1019 | |
| 1020 | void fio_fill_default_options(struct thread_data *td) |
| 1021 | { |
| 1022 | fill_default_options(td, options); |
| 1023 | } |
| 1024 | |
| 1025 | int fio_show_option_help(const char *opt) |
| 1026 | { |
| 1027 | return show_cmd_help(options, opt); |
| 1028 | } |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1029 | |
| 1030 | static void __options_mem(struct thread_data *td, int alloc) |
| 1031 | { |
| 1032 | struct thread_options *o = &td->o; |
| 1033 | struct fio_option *opt; |
| 1034 | char **ptr; |
| 1035 | int i; |
| 1036 | |
| 1037 | for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) { |
| 1038 | if (opt->type != FIO_OPT_STR_STORE) |
| 1039 | continue; |
| 1040 | |
| 1041 | ptr = (void *) o + opt->off1; |
| 1042 | if (*ptr) { |
| 1043 | if (alloc) |
| 1044 | *ptr = strdup(*ptr); |
| 1045 | else { |
| 1046 | free(*ptr); |
| 1047 | *ptr = NULL; |
| 1048 | } |
| 1049 | } |
| 1050 | } |
| 1051 | } |
| 1052 | |
| 1053 | /* |
| 1054 | * dupe FIO_OPT_STR_STORE options |
| 1055 | */ |
| 1056 | void options_mem_dupe(struct thread_data *td) |
| 1057 | { |
| 1058 | __options_mem(td, 1); |
| 1059 | } |
| 1060 | |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1061 | void options_mem_free(struct thread_data fio_unused *td) |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1062 | { |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1063 | #if 0 |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1064 | __options_mem(td, 0); |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1065 | #endif |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1066 | } |