Commit | Line | Data |
---|---|---|
214e1eca JA |
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> | |
921c766f | 8 | #include <libgen.h> |
5921e80c JA |
9 | #include <fcntl.h> |
10 | #include <sys/types.h> | |
11 | #include <sys/stat.h> | |
214e1eca JA |
12 | |
13 | #include "fio.h" | |
14 | #include "parse.h" | |
eef32359 | 15 | #include "lib/fls.h" |
214e1eca | 16 | |
2dc1bbeb | 17 | #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) |
214e1eca JA |
18 | |
19 | /* | |
20 | * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that. | |
21 | */ | |
22 | static char *get_opt_postfix(const char *str) | |
23 | { | |
24 | char *p = strstr(str, ":"); | |
25 | ||
26 | if (!p) | |
27 | return NULL; | |
28 | ||
29 | p++; | |
30 | strip_blank_front(&p); | |
31 | strip_blank_end(p); | |
32 | return strdup(p); | |
33 | } | |
34 | ||
564ca972 JA |
35 | static int bs_cmp(const void *p1, const void *p2) |
36 | { | |
37 | const struct bssplit *bsp1 = p1; | |
38 | const struct bssplit *bsp2 = p2; | |
39 | ||
40 | return bsp1->perc < bsp2->perc; | |
41 | } | |
42 | ||
43 | static int str_bssplit_cb(void *data, const char *input) | |
44 | { | |
45 | struct thread_data *td = data; | |
46 | char *fname, *str, *p; | |
47 | unsigned int i, perc, perc_missing; | |
48 | unsigned int max_bs, min_bs; | |
49 | long long val; | |
50 | ||
51 | p = str = strdup(input); | |
52 | ||
53 | strip_blank_front(&str); | |
54 | strip_blank_end(str); | |
55 | ||
56 | td->o.bssplit_nr = 4; | |
57 | td->o.bssplit = malloc(4 * sizeof(struct bssplit)); | |
58 | ||
59 | i = 0; | |
60 | max_bs = 0; | |
61 | min_bs = -1; | |
62 | while ((fname = strsep(&str, ":")) != NULL) { | |
63 | char *perc_str; | |
64 | ||
65 | if (!strlen(fname)) | |
66 | break; | |
67 | ||
68 | /* | |
69 | * grow struct buffer, if needed | |
70 | */ | |
71 | if (i == td->o.bssplit_nr) { | |
72 | td->o.bssplit_nr <<= 1; | |
5ec10eaa JA |
73 | td->o.bssplit = realloc(td->o.bssplit, |
74 | td->o.bssplit_nr | |
75 | * sizeof(struct bssplit)); | |
564ca972 JA |
76 | } |
77 | ||
78 | perc_str = strstr(fname, "/"); | |
79 | if (perc_str) { | |
80 | *perc_str = '\0'; | |
81 | perc_str++; | |
82 | perc = atoi(perc_str); | |
83 | if (perc > 100) | |
84 | perc = 100; | |
85 | else if (!perc) | |
86 | perc = -1; | |
87 | } else | |
88 | perc = -1; | |
89 | ||
90 | if (str_to_decimal(fname, &val, 1)) { | |
91 | log_err("fio: bssplit conversion failed\n"); | |
92 | free(td->o.bssplit); | |
93 | return 1; | |
94 | } | |
95 | ||
96 | if (val > max_bs) | |
97 | max_bs = val; | |
98 | if (val < min_bs) | |
99 | min_bs = val; | |
100 | ||
101 | td->o.bssplit[i].bs = val; | |
102 | td->o.bssplit[i].perc = perc; | |
103 | i++; | |
104 | } | |
105 | ||
106 | td->o.bssplit_nr = i; | |
107 | ||
108 | /* | |
109 | * Now check if the percentages add up, and how much is missing | |
110 | */ | |
111 | perc = perc_missing = 0; | |
112 | for (i = 0; i < td->o.bssplit_nr; i++) { | |
113 | struct bssplit *bsp = &td->o.bssplit[i]; | |
114 | ||
115 | if (bsp->perc == (unsigned char) -1) | |
116 | perc_missing++; | |
117 | else | |
118 | perc += bsp->perc; | |
119 | } | |
120 | ||
121 | if (perc > 100) { | |
122 | log_err("fio: bssplit percentages add to more than 100%%\n"); | |
123 | free(td->o.bssplit); | |
124 | return 1; | |
125 | } | |
126 | /* | |
127 | * If values didn't have a percentage set, divide the remains between | |
128 | * them. | |
129 | */ | |
130 | if (perc_missing) { | |
131 | for (i = 0; i < td->o.bssplit_nr; i++) { | |
132 | struct bssplit *bsp = &td->o.bssplit[i]; | |
133 | ||
134 | if (bsp->perc == (unsigned char) -1) | |
135 | bsp->perc = (100 - perc) / perc_missing; | |
136 | } | |
137 | } | |
138 | ||
139 | td->o.min_bs[DDIR_READ] = td->o.min_bs[DDIR_WRITE] = min_bs; | |
140 | td->o.max_bs[DDIR_READ] = td->o.max_bs[DDIR_WRITE] = max_bs; | |
141 | ||
142 | /* | |
143 | * now sort based on percentages, for ease of lookup | |
144 | */ | |
145 | qsort(td->o.bssplit, td->o.bssplit_nr, sizeof(struct bssplit), bs_cmp); | |
146 | ||
147 | free(p); | |
148 | return 0; | |
149 | } | |
150 | ||
211097b2 JA |
151 | static int str_rw_cb(void *data, const char *str) |
152 | { | |
153 | struct thread_data *td = data; | |
154 | char *nr = get_opt_postfix(str); | |
155 | ||
fafdba3c | 156 | td->o.ddir_nr = 1; |
182ec6ee | 157 | if (nr) { |
211097b2 | 158 | td->o.ddir_nr = atoi(nr); |
182ec6ee JA |
159 | free(nr); |
160 | } | |
211097b2 | 161 | |
211097b2 JA |
162 | return 0; |
163 | } | |
164 | ||
214e1eca JA |
165 | static int str_mem_cb(void *data, const char *mem) |
166 | { | |
167 | struct thread_data *td = data; | |
168 | ||
2dc1bbeb | 169 | if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) { |
214e1eca | 170 | td->mmapfile = get_opt_postfix(mem); |
2dc1bbeb | 171 | if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) { |
214e1eca JA |
172 | log_err("fio: mmaphuge:/path/to/file\n"); |
173 | return 1; | |
174 | } | |
175 | } | |
176 | ||
177 | return 0; | |
178 | } | |
179 | ||
180 | static int str_lockmem_cb(void fio_unused *data, unsigned long *val) | |
181 | { | |
182 | mlock_size = *val; | |
183 | return 0; | |
184 | } | |
185 | ||
cb499fc4 JA |
186 | static int str_rwmix_read_cb(void *data, unsigned int *val) |
187 | { | |
188 | struct thread_data *td = data; | |
189 | ||
190 | td->o.rwmix[DDIR_READ] = *val; | |
191 | td->o.rwmix[DDIR_WRITE] = 100 - *val; | |
192 | return 0; | |
193 | } | |
194 | ||
195 | static int str_rwmix_write_cb(void *data, unsigned int *val) | |
196 | { | |
197 | struct thread_data *td = data; | |
198 | ||
199 | td->o.rwmix[DDIR_WRITE] = *val; | |
200 | td->o.rwmix[DDIR_READ] = 100 - *val; | |
201 | return 0; | |
202 | } | |
203 | ||
214e1eca JA |
204 | #ifdef FIO_HAVE_IOPRIO |
205 | static int str_prioclass_cb(void *data, unsigned int *val) | |
206 | { | |
207 | struct thread_data *td = data; | |
6cefbe33 JA |
208 | unsigned short mask; |
209 | ||
210 | /* | |
211 | * mask off old class bits, str_prio_cb() may have set a default class | |
212 | */ | |
213 | mask = (1 << IOPRIO_CLASS_SHIFT) - 1; | |
214 | td->ioprio &= mask; | |
214e1eca JA |
215 | |
216 | td->ioprio |= *val << IOPRIO_CLASS_SHIFT; | |
ac684785 | 217 | td->ioprio_set = 1; |
214e1eca JA |
218 | return 0; |
219 | } | |
220 | ||
221 | static int str_prio_cb(void *data, unsigned int *val) | |
222 | { | |
223 | struct thread_data *td = data; | |
224 | ||
225 | td->ioprio |= *val; | |
6cefbe33 JA |
226 | |
227 | /* | |
228 | * If no class is set, assume BE | |
229 | */ | |
230 | if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0) | |
231 | td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT; | |
232 | ||
ac684785 | 233 | td->ioprio_set = 1; |
214e1eca JA |
234 | return 0; |
235 | } | |
236 | #endif | |
237 | ||
238 | static int str_exitall_cb(void) | |
239 | { | |
240 | exitall_on_terminate = 1; | |
241 | return 0; | |
242 | } | |
243 | ||
214e1eca | 244 | #ifdef FIO_HAVE_CPU_AFFINITY |
d2e268b0 JA |
245 | static int str_cpumask_cb(void *data, unsigned int *val) |
246 | { | |
247 | struct thread_data *td = data; | |
214e1eca JA |
248 | unsigned int i; |
249 | ||
d2e268b0 | 250 | CPU_ZERO(&td->o.cpumask); |
214e1eca | 251 | |
e600f7f1 | 252 | for (i = 0; i < sizeof(int) * 8; i++) |
d2e268b0 JA |
253 | if ((1 << i) & *val) |
254 | CPU_SET(*val, &td->o.cpumask); | |
255 | ||
256 | td->o.cpumask_set = 1; | |
257 | return 0; | |
214e1eca JA |
258 | } |
259 | ||
d2e268b0 | 260 | static int str_cpus_allowed_cb(void *data, const char *input) |
214e1eca JA |
261 | { |
262 | struct thread_data *td = data; | |
d2e268b0 JA |
263 | char *cpu, *str, *p; |
264 | ||
265 | CPU_ZERO(&td->o.cpumask); | |
266 | ||
267 | p = str = strdup(input); | |
214e1eca | 268 | |
d2e268b0 JA |
269 | strip_blank_front(&str); |
270 | strip_blank_end(str); | |
271 | ||
272 | while ((cpu = strsep(&str, ",")) != NULL) { | |
273 | if (!strlen(cpu)) | |
274 | break; | |
275 | CPU_SET(atoi(cpu), &td->o.cpumask); | |
276 | } | |
277 | ||
278 | free(p); | |
375b2695 | 279 | td->o.cpumask_set = 1; |
214e1eca JA |
280 | return 0; |
281 | } | |
d2e268b0 | 282 | #endif |
214e1eca JA |
283 | |
284 | static int str_fst_cb(void *data, const char *str) | |
285 | { | |
286 | struct thread_data *td = data; | |
287 | char *nr = get_opt_postfix(str); | |
288 | ||
289 | td->file_service_nr = 1; | |
182ec6ee | 290 | if (nr) { |
214e1eca | 291 | td->file_service_nr = atoi(nr); |
182ec6ee JA |
292 | free(nr); |
293 | } | |
214e1eca JA |
294 | |
295 | return 0; | |
296 | } | |
297 | ||
921c766f JA |
298 | static int check_dir(struct thread_data *td, char *fname) |
299 | { | |
300 | char file[PATH_MAX], *dir; | |
bc838919 | 301 | int elen = 0; |
921c766f | 302 | |
bc838919 JA |
303 | if (td->o.directory) { |
304 | strcpy(file, td->o.directory); | |
fcef0b35 | 305 | strcat(file, "/"); |
bc838919 JA |
306 | elen = strlen(file); |
307 | } | |
308 | ||
fcef0b35 | 309 | sprintf(file + elen, "%s", fname); |
921c766f JA |
310 | dir = dirname(file); |
311 | ||
fcef0b35 JA |
312 | #if 0 |
313 | { | |
314 | struct stat sb; | |
315 | /* | |
316 | * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded | |
317 | * yet, so we can't do this check right here... | |
318 | */ | |
921c766f JA |
319 | if (lstat(dir, &sb) < 0) { |
320 | int ret = errno; | |
321 | ||
322 | log_err("fio: %s is not a directory\n", dir); | |
323 | td_verror(td, ret, "lstat"); | |
324 | return 1; | |
325 | } | |
326 | ||
327 | if (!S_ISDIR(sb.st_mode)) { | |
328 | log_err("fio: %s is not a directory\n", dir); | |
329 | return 1; | |
330 | } | |
fcef0b35 JA |
331 | } |
332 | #endif | |
921c766f JA |
333 | |
334 | return 0; | |
335 | } | |
336 | ||
214e1eca JA |
337 | static int str_filename_cb(void *data, const char *input) |
338 | { | |
339 | struct thread_data *td = data; | |
340 | char *fname, *str, *p; | |
341 | ||
342 | p = str = strdup(input); | |
343 | ||
344 | strip_blank_front(&str); | |
345 | strip_blank_end(str); | |
346 | ||
347 | if (!td->files_index) | |
2dc1bbeb | 348 | td->o.nr_files = 0; |
214e1eca JA |
349 | |
350 | while ((fname = strsep(&str, ":")) != NULL) { | |
351 | if (!strlen(fname)) | |
352 | break; | |
921c766f JA |
353 | if (check_dir(td, fname)) { |
354 | free(p); | |
355 | return 1; | |
356 | } | |
214e1eca | 357 | add_file(td, fname); |
2dc1bbeb | 358 | td->o.nr_files++; |
214e1eca JA |
359 | } |
360 | ||
361 | free(p); | |
362 | return 0; | |
363 | } | |
364 | ||
365 | static int str_directory_cb(void *data, const char fio_unused *str) | |
366 | { | |
367 | struct thread_data *td = data; | |
368 | struct stat sb; | |
369 | ||
2dc1bbeb | 370 | if (lstat(td->o.directory, &sb) < 0) { |
921c766f JA |
371 | int ret = errno; |
372 | ||
2dc1bbeb | 373 | log_err("fio: %s is not a directory\n", td->o.directory); |
921c766f | 374 | td_verror(td, ret, "lstat"); |
214e1eca JA |
375 | return 1; |
376 | } | |
377 | if (!S_ISDIR(sb.st_mode)) { | |
2dc1bbeb | 378 | log_err("fio: %s is not a directory\n", td->o.directory); |
214e1eca JA |
379 | return 1; |
380 | } | |
381 | ||
382 | return 0; | |
383 | } | |
384 | ||
385 | static int str_opendir_cb(void *data, const char fio_unused *str) | |
386 | { | |
387 | struct thread_data *td = data; | |
388 | ||
389 | if (!td->files_index) | |
2dc1bbeb | 390 | td->o.nr_files = 0; |
214e1eca | 391 | |
2dc1bbeb | 392 | return add_dir_files(td, td->o.opendir); |
214e1eca JA |
393 | } |
394 | ||
a59e170d | 395 | static int str_verify_offset_cb(void *data, unsigned int *off) |
546a9142 SL |
396 | { |
397 | struct thread_data *td = data; | |
a59e170d | 398 | |
546a9142 | 399 | if (*off && *off < sizeof(struct verify_header)) { |
a59e170d | 400 | log_err("fio: verify_offset too small\n"); |
546a9142 SL |
401 | return 1; |
402 | } | |
a59e170d JA |
403 | |
404 | td->o.verify_offset = *off; | |
546a9142 SL |
405 | return 0; |
406 | } | |
407 | ||
e28218f3 | 408 | static int str_verify_pattern_cb(void *data, unsigned int *off) |
90059d65 JA |
409 | { |
410 | struct thread_data *td = data; | |
e28218f3 | 411 | unsigned int msb; |
90059d65 | 412 | |
3c48c2c1 | 413 | msb = __fls(*off); |
90059d65 JA |
414 | if (msb <= 8) |
415 | td->o.verify_pattern_bytes = 1; | |
416 | else if (msb <= 16) | |
417 | td->o.verify_pattern_bytes = 2; | |
418 | else if (msb <= 24) | |
419 | td->o.verify_pattern_bytes = 3; | |
420 | else | |
421 | td->o.verify_pattern_bytes = 4; | |
422 | ||
e28218f3 | 423 | td->o.verify_pattern = *off; |
90059d65 JA |
424 | return 0; |
425 | } | |
214e1eca | 426 | |
4d4e80f2 JA |
427 | static int str_lockfile_cb(void *data, const char *str) |
428 | { | |
429 | struct thread_data *td = data; | |
430 | char *nr = get_opt_postfix(str); | |
431 | ||
432 | td->o.lockfile_batch = 1; | |
182ec6ee | 433 | if (nr) { |
4d4e80f2 | 434 | td->o.lockfile_batch = atoi(nr); |
182ec6ee JA |
435 | free(nr); |
436 | } | |
4d4e80f2 JA |
437 | |
438 | return 0; | |
439 | } | |
440 | ||
e3cedca7 JA |
441 | static int str_write_bw_log_cb(void *data, const char *str) |
442 | { | |
443 | struct thread_data *td = data; | |
444 | ||
445 | if (str) | |
446 | td->o.bw_log_file = strdup(str); | |
447 | ||
448 | td->o.write_bw_log = 1; | |
449 | return 0; | |
450 | } | |
451 | ||
452 | static int str_write_lat_log_cb(void *data, const char *str) | |
453 | { | |
454 | struct thread_data *td = data; | |
455 | ||
456 | if (str) | |
457 | td->o.lat_log_file = strdup(str); | |
458 | ||
459 | td->o.write_lat_log = 1; | |
460 | return 0; | |
461 | } | |
462 | ||
993bf48b JA |
463 | static int str_gtod_reduce_cb(void *data, int *il) |
464 | { | |
465 | struct thread_data *td = data; | |
466 | int val = *il; | |
467 | ||
468 | td->o.disable_clat = !!val; | |
469 | td->o.disable_slat = !!val; | |
470 | td->o.disable_bw = !!val; | |
471 | if (val) | |
472 | td->tv_cache_mask = 63; | |
473 | ||
474 | return 0; | |
475 | } | |
476 | ||
214e1eca JA |
477 | #define __stringify_1(x) #x |
478 | #define __stringify(x) __stringify_1(x) | |
479 | ||
480 | /* | |
481 | * Map of job/command line options | |
482 | */ | |
483 | static struct fio_option options[] = { | |
484 | { | |
485 | .name = "description", | |
486 | .type = FIO_OPT_STR_STORE, | |
487 | .off1 = td_var_offset(description), | |
488 | .help = "Text job description", | |
489 | }, | |
490 | { | |
491 | .name = "name", | |
492 | .type = FIO_OPT_STR_STORE, | |
493 | .off1 = td_var_offset(name), | |
494 | .help = "Name of this job", | |
495 | }, | |
496 | { | |
497 | .name = "directory", | |
498 | .type = FIO_OPT_STR_STORE, | |
499 | .off1 = td_var_offset(directory), | |
500 | .cb = str_directory_cb, | |
501 | .help = "Directory to store files in", | |
502 | }, | |
503 | { | |
504 | .name = "filename", | |
505 | .type = FIO_OPT_STR_STORE, | |
506 | .off1 = td_var_offset(filename), | |
507 | .cb = str_filename_cb, | |
3b8b7135 | 508 | .prio = 1, /* must come before "directory" */ |
214e1eca JA |
509 | .help = "File(s) to use for the workload", |
510 | }, | |
29c1349f JA |
511 | { |
512 | .name = "lockfile", | |
4d4e80f2 JA |
513 | .type = FIO_OPT_STR, |
514 | .cb = str_lockfile_cb, | |
515 | .off1 = td_var_offset(file_lock_mode), | |
29c1349f JA |
516 | .help = "Lock file when doing IO to it", |
517 | .parent = "filename", | |
4d4e80f2 JA |
518 | .def = "none", |
519 | .posval = { | |
520 | { .ival = "none", | |
521 | .oval = FILE_LOCK_NONE, | |
522 | .help = "No file locking", | |
523 | }, | |
524 | { .ival = "exclusive", | |
525 | .oval = FILE_LOCK_EXCLUSIVE, | |
526 | .help = "Exclusive file lock", | |
527 | }, | |
528 | { | |
529 | .ival = "readwrite", | |
530 | .oval = FILE_LOCK_READWRITE, | |
531 | .help = "Read vs write lock", | |
532 | }, | |
533 | }, | |
29c1349f | 534 | }, |
214e1eca JA |
535 | { |
536 | .name = "opendir", | |
537 | .type = FIO_OPT_STR_STORE, | |
538 | .off1 = td_var_offset(opendir), | |
539 | .cb = str_opendir_cb, | |
540 | .help = "Recursively add files from this directory and down", | |
541 | }, | |
542 | { | |
543 | .name = "rw", | |
d3aad8f2 | 544 | .alias = "readwrite", |
214e1eca | 545 | .type = FIO_OPT_STR, |
211097b2 | 546 | .cb = str_rw_cb, |
214e1eca JA |
547 | .off1 = td_var_offset(td_ddir), |
548 | .help = "IO direction", | |
549 | .def = "read", | |
550 | .posval = { | |
551 | { .ival = "read", | |
552 | .oval = TD_DDIR_READ, | |
553 | .help = "Sequential read", | |
554 | }, | |
555 | { .ival = "write", | |
556 | .oval = TD_DDIR_WRITE, | |
557 | .help = "Sequential write", | |
558 | }, | |
559 | { .ival = "randread", | |
560 | .oval = TD_DDIR_RANDREAD, | |
561 | .help = "Random read", | |
562 | }, | |
563 | { .ival = "randwrite", | |
564 | .oval = TD_DDIR_RANDWRITE, | |
565 | .help = "Random write", | |
566 | }, | |
567 | { .ival = "rw", | |
568 | .oval = TD_DDIR_RW, | |
569 | .help = "Sequential read and write mix", | |
570 | }, | |
571 | { .ival = "randrw", | |
572 | .oval = TD_DDIR_RANDRW, | |
573 | .help = "Random read and write mix" | |
574 | }, | |
575 | }, | |
576 | }, | |
577 | { | |
578 | .name = "ioengine", | |
579 | .type = FIO_OPT_STR_STORE, | |
580 | .off1 = td_var_offset(ioengine), | |
581 | .help = "IO engine to use", | |
582 | .def = "sync", | |
583 | .posval = { | |
584 | { .ival = "sync", | |
585 | .help = "Use read/write", | |
586 | }, | |
a31041ea | 587 | { .ival = "psync", |
588 | .help = "Use pread/pwrite", | |
589 | }, | |
1d2af02a JA |
590 | { .ival = "vsync", |
591 | .help = "Use readv/writev", | |
592 | }, | |
214e1eca JA |
593 | #ifdef FIO_HAVE_LIBAIO |
594 | { .ival = "libaio", | |
595 | .help = "Linux native asynchronous IO", | |
596 | }, | |
597 | #endif | |
598 | #ifdef FIO_HAVE_POSIXAIO | |
599 | { .ival = "posixaio", | |
600 | .help = "POSIX asynchronous IO", | |
601 | }, | |
417f0068 JA |
602 | #endif |
603 | #ifdef FIO_HAVE_SOLARISAIO | |
604 | { .ival = "solarisaio", | |
605 | .help = "Solaris native asynchronous IO", | |
606 | }, | |
214e1eca JA |
607 | #endif |
608 | { .ival = "mmap", | |
609 | .help = "Memory mapped IO", | |
610 | }, | |
611 | #ifdef FIO_HAVE_SPLICE | |
612 | { .ival = "splice", | |
613 | .help = "splice/vmsplice based IO", | |
614 | }, | |
9cce02e8 JA |
615 | { .ival = "netsplice", |
616 | .help = "splice/vmsplice to/from the network", | |
617 | }, | |
214e1eca JA |
618 | #endif |
619 | #ifdef FIO_HAVE_SGIO | |
620 | { .ival = "sg", | |
621 | .help = "SCSI generic v3 IO", | |
622 | }, | |
623 | #endif | |
624 | { .ival = "null", | |
625 | .help = "Testing engine (no data transfer)", | |
626 | }, | |
627 | { .ival = "net", | |
628 | .help = "Network IO", | |
629 | }, | |
630 | #ifdef FIO_HAVE_SYSLET | |
631 | { .ival = "syslet-rw", | |
632 | .help = "syslet enabled async pread/pwrite IO", | |
633 | }, | |
634 | #endif | |
635 | { .ival = "cpuio", | |
636 | .help = "CPU cycler burner engine", | |
637 | }, | |
b8c82a46 JA |
638 | #ifdef FIO_HAVE_GUASI |
639 | { .ival = "guasi", | |
640 | .help = "GUASI IO engine", | |
641 | }, | |
642 | #endif | |
214e1eca JA |
643 | { .ival = "external", |
644 | .help = "Load external engine (append name)", | |
645 | }, | |
646 | }, | |
647 | }, | |
648 | { | |
649 | .name = "iodepth", | |
650 | .type = FIO_OPT_INT, | |
651 | .off1 = td_var_offset(iodepth), | |
652 | .help = "Amount of IO buffers to keep in flight", | |
757aff4f | 653 | .minval = 1, |
214e1eca JA |
654 | .def = "1", |
655 | }, | |
656 | { | |
657 | .name = "iodepth_batch", | |
4950421a | 658 | .alias = "iodepth_batch_submit", |
214e1eca JA |
659 | .type = FIO_OPT_INT, |
660 | .off1 = td_var_offset(iodepth_batch), | |
661 | .help = "Number of IO to submit in one go", | |
afdf9352 | 662 | .parent = "iodepth", |
a2e6f8ac JA |
663 | .minval = 1, |
664 | .def = "1", | |
4950421a JA |
665 | }, |
666 | { | |
667 | .name = "iodepth_batch_complete", | |
668 | .type = FIO_OPT_INT, | |
669 | .off1 = td_var_offset(iodepth_batch_complete), | |
670 | .help = "Number of IO to retrieve in one go", | |
671 | .parent = "iodepth", | |
672 | .minval = 0, | |
673 | .def = "1", | |
214e1eca JA |
674 | }, |
675 | { | |
676 | .name = "iodepth_low", | |
677 | .type = FIO_OPT_INT, | |
678 | .off1 = td_var_offset(iodepth_low), | |
679 | .help = "Low water mark for queuing depth", | |
afdf9352 | 680 | .parent = "iodepth", |
214e1eca JA |
681 | }, |
682 | { | |
683 | .name = "size", | |
684 | .type = FIO_OPT_STR_VAL, | |
2dc1bbeb | 685 | .off1 = td_var_offset(size), |
c3edbdba | 686 | .minval = 1, |
214e1eca JA |
687 | .help = "Total size of device or files", |
688 | }, | |
aa31f1f1 SL |
689 | { |
690 | .name = "fill_device", | |
691 | .type = FIO_OPT_BOOL, | |
692 | .off1 = td_var_offset(fill_device), | |
693 | .help = "Write until an ENOSPC error occurs", | |
694 | .def = "0", | |
695 | }, | |
214e1eca JA |
696 | { |
697 | .name = "filesize", | |
698 | .type = FIO_OPT_STR_VAL, | |
699 | .off1 = td_var_offset(file_size_low), | |
700 | .off2 = td_var_offset(file_size_high), | |
c3edbdba | 701 | .minval = 1, |
214e1eca JA |
702 | .help = "Size of individual files", |
703 | }, | |
67a1000f JA |
704 | { |
705 | .name = "offset", | |
706 | .alias = "fileoffset", | |
707 | .type = FIO_OPT_STR_VAL, | |
708 | .off1 = td_var_offset(start_offset), | |
709 | .help = "Start IO from this offset", | |
710 | .def = "0", | |
711 | }, | |
214e1eca JA |
712 | { |
713 | .name = "bs", | |
d3aad8f2 | 714 | .alias = "blocksize", |
214e1eca JA |
715 | .type = FIO_OPT_STR_VAL_INT, |
716 | .off1 = td_var_offset(bs[DDIR_READ]), | |
717 | .off2 = td_var_offset(bs[DDIR_WRITE]), | |
c3edbdba | 718 | .minval = 1, |
214e1eca JA |
719 | .help = "Block size unit", |
720 | .def = "4k", | |
67a1000f | 721 | .parent = "rw", |
214e1eca JA |
722 | }, |
723 | { | |
724 | .name = "bsrange", | |
d3aad8f2 | 725 | .alias = "blocksize_range", |
214e1eca JA |
726 | .type = FIO_OPT_RANGE, |
727 | .off1 = td_var_offset(min_bs[DDIR_READ]), | |
728 | .off2 = td_var_offset(max_bs[DDIR_READ]), | |
729 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), | |
730 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), | |
c3edbdba | 731 | .minval = 1, |
214e1eca | 732 | .help = "Set block size range (in more detail than bs)", |
67a1000f | 733 | .parent = "rw", |
214e1eca | 734 | }, |
564ca972 JA |
735 | { |
736 | .name = "bssplit", | |
737 | .type = FIO_OPT_STR, | |
738 | .cb = str_bssplit_cb, | |
739 | .help = "Set a specific mix of block sizes", | |
740 | .parent = "rw", | |
741 | }, | |
214e1eca JA |
742 | { |
743 | .name = "bs_unaligned", | |
d3aad8f2 | 744 | .alias = "blocksize_unaligned", |
214e1eca JA |
745 | .type = FIO_OPT_STR_SET, |
746 | .off1 = td_var_offset(bs_unaligned), | |
747 | .help = "Don't sector align IO buffer sizes", | |
67a1000f | 748 | .parent = "rw", |
214e1eca JA |
749 | }, |
750 | { | |
751 | .name = "randrepeat", | |
752 | .type = FIO_OPT_BOOL, | |
753 | .off1 = td_var_offset(rand_repeatable), | |
754 | .help = "Use repeatable random IO pattern", | |
755 | .def = "1", | |
67a1000f | 756 | .parent = "rw", |
214e1eca JA |
757 | }, |
758 | { | |
759 | .name = "norandommap", | |
760 | .type = FIO_OPT_STR_SET, | |
761 | .off1 = td_var_offset(norandommap), | |
762 | .help = "Accept potential duplicate random blocks", | |
67a1000f | 763 | .parent = "rw", |
214e1eca | 764 | }, |
2b386d25 JA |
765 | { |
766 | .name = "softrandommap", | |
767 | .type = FIO_OPT_BOOL, | |
768 | .off1 = td_var_offset(softrandommap), | |
f66ab3c8 | 769 | .help = "Set norandommap if randommap allocation fails", |
2b386d25 JA |
770 | .parent = "norandommap", |
771 | .def = "0", | |
772 | }, | |
214e1eca JA |
773 | { |
774 | .name = "nrfiles", | |
775 | .type = FIO_OPT_INT, | |
776 | .off1 = td_var_offset(nr_files), | |
777 | .help = "Split job workload between this number of files", | |
778 | .def = "1", | |
779 | }, | |
780 | { | |
781 | .name = "openfiles", | |
782 | .type = FIO_OPT_INT, | |
783 | .off1 = td_var_offset(open_files), | |
784 | .help = "Number of files to keep open at the same time", | |
785 | }, | |
786 | { | |
787 | .name = "file_service_type", | |
788 | .type = FIO_OPT_STR, | |
789 | .cb = str_fst_cb, | |
790 | .off1 = td_var_offset(file_service_type), | |
791 | .help = "How to select which file to service next", | |
792 | .def = "roundrobin", | |
793 | .posval = { | |
794 | { .ival = "random", | |
795 | .oval = FIO_FSERVICE_RANDOM, | |
796 | .help = "Choose a file at random", | |
797 | }, | |
798 | { .ival = "roundrobin", | |
799 | .oval = FIO_FSERVICE_RR, | |
800 | .help = "Round robin select files", | |
801 | }, | |
802 | }, | |
67a1000f JA |
803 | .parent = "nrfiles", |
804 | }, | |
805 | { | |
806 | .name = "fadvise_hint", | |
807 | .type = FIO_OPT_BOOL, | |
808 | .off1 = td_var_offset(fadvise_hint), | |
809 | .help = "Use fadvise() to advise the kernel on IO pattern", | |
810 | .def = "1", | |
214e1eca JA |
811 | }, |
812 | { | |
813 | .name = "fsync", | |
814 | .type = FIO_OPT_INT, | |
815 | .off1 = td_var_offset(fsync_blocks), | |
816 | .help = "Issue fsync for writes every given number of blocks", | |
817 | .def = "0", | |
818 | }, | |
819 | { | |
820 | .name = "direct", | |
821 | .type = FIO_OPT_BOOL, | |
822 | .off1 = td_var_offset(odirect), | |
823 | .help = "Use O_DIRECT IO (negates buffered)", | |
824 | .def = "0", | |
825 | }, | |
826 | { | |
827 | .name = "buffered", | |
828 | .type = FIO_OPT_BOOL, | |
829 | .off1 = td_var_offset(odirect), | |
830 | .neg = 1, | |
831 | .help = "Use buffered IO (negates direct)", | |
832 | .def = "1", | |
833 | }, | |
834 | { | |
835 | .name = "overwrite", | |
836 | .type = FIO_OPT_BOOL, | |
837 | .off1 = td_var_offset(overwrite), | |
838 | .help = "When writing, set whether to overwrite current data", | |
839 | .def = "0", | |
840 | }, | |
841 | { | |
842 | .name = "loops", | |
843 | .type = FIO_OPT_INT, | |
844 | .off1 = td_var_offset(loops), | |
845 | .help = "Number of times to run the job", | |
846 | .def = "1", | |
847 | }, | |
848 | { | |
849 | .name = "numjobs", | |
850 | .type = FIO_OPT_INT, | |
851 | .off1 = td_var_offset(numjobs), | |
852 | .help = "Duplicate this job this many times", | |
853 | .def = "1", | |
854 | }, | |
855 | { | |
856 | .name = "startdelay", | |
857 | .type = FIO_OPT_INT, | |
858 | .off1 = td_var_offset(start_delay), | |
859 | .help = "Only start job when this period has passed", | |
860 | .def = "0", | |
861 | }, | |
862 | { | |
863 | .name = "runtime", | |
864 | .alias = "timeout", | |
865 | .type = FIO_OPT_STR_VAL_TIME, | |
866 | .off1 = td_var_offset(timeout), | |
867 | .help = "Stop workload when this amount of time has passed", | |
868 | .def = "0", | |
869 | }, | |
cf4464ca JA |
870 | { |
871 | .name = "time_based", | |
872 | .type = FIO_OPT_STR_SET, | |
873 | .off1 = td_var_offset(time_based), | |
874 | .help = "Keep running until runtime/timeout is met", | |
875 | }, | |
721938ae JA |
876 | { |
877 | .name = "ramp_time", | |
878 | .type = FIO_OPT_STR_VAL_TIME, | |
879 | .off1 = td_var_offset(ramp_time), | |
880 | .help = "Ramp up time before measuring performance", | |
881 | }, | |
214e1eca JA |
882 | { |
883 | .name = "mem", | |
d3aad8f2 | 884 | .alias = "iomem", |
214e1eca JA |
885 | .type = FIO_OPT_STR, |
886 | .cb = str_mem_cb, | |
887 | .off1 = td_var_offset(mem_type), | |
888 | .help = "Backing type for IO buffers", | |
889 | .def = "malloc", | |
890 | .posval = { | |
891 | { .ival = "malloc", | |
892 | .oval = MEM_MALLOC, | |
893 | .help = "Use malloc(3) for IO buffers", | |
894 | }, | |
37c8cdfe JA |
895 | { .ival = "shm", |
896 | .oval = MEM_SHM, | |
897 | .help = "Use shared memory segments for IO buffers", | |
898 | }, | |
214e1eca JA |
899 | #ifdef FIO_HAVE_HUGETLB |
900 | { .ival = "shmhuge", | |
901 | .oval = MEM_SHMHUGE, | |
902 | .help = "Like shm, but use huge pages", | |
903 | }, | |
b370e46a | 904 | #endif |
37c8cdfe JA |
905 | { .ival = "mmap", |
906 | .oval = MEM_MMAP, | |
907 | .help = "Use mmap(2) (file or anon) for IO buffers", | |
908 | }, | |
214e1eca JA |
909 | #ifdef FIO_HAVE_HUGETLB |
910 | { .ival = "mmaphuge", | |
911 | .oval = MEM_MMAPHUGE, | |
912 | .help = "Like mmap, but use huge pages", | |
913 | }, | |
914 | #endif | |
915 | }, | |
916 | }, | |
917 | { | |
918 | .name = "verify", | |
919 | .type = FIO_OPT_STR, | |
920 | .off1 = td_var_offset(verify), | |
921 | .help = "Verify data written", | |
922 | .def = "0", | |
923 | .posval = { | |
924 | { .ival = "0", | |
925 | .oval = VERIFY_NONE, | |
926 | .help = "Don't do IO verification", | |
927 | }, | |
fcca4b58 JA |
928 | { .ival = "md5", |
929 | .oval = VERIFY_MD5, | |
930 | .help = "Use md5 checksums for verification", | |
931 | }, | |
d77a7af3 JA |
932 | { .ival = "crc64", |
933 | .oval = VERIFY_CRC64, | |
934 | .help = "Use crc64 checksums for verification", | |
935 | }, | |
214e1eca JA |
936 | { .ival = "crc32", |
937 | .oval = VERIFY_CRC32, | |
938 | .help = "Use crc32 checksums for verification", | |
939 | }, | |
af497e6a JA |
940 | { .ival = "crc32c-intel", |
941 | .oval = VERIFY_CRC32C_INTEL, | |
942 | .help = "Use hw crc32c checksums for verification", | |
943 | }, | |
bac39e0e JA |
944 | { .ival = "crc32c", |
945 | .oval = VERIFY_CRC32C, | |
946 | .help = "Use crc32c checksums for verification", | |
947 | }, | |
969f7ed3 JA |
948 | { .ival = "crc16", |
949 | .oval = VERIFY_CRC16, | |
950 | .help = "Use crc16 checksums for verification", | |
951 | }, | |
1e154bdb JA |
952 | { .ival = "crc7", |
953 | .oval = VERIFY_CRC7, | |
954 | .help = "Use crc7 checksums for verification", | |
955 | }, | |
cd14cc10 JA |
956 | { .ival = "sha256", |
957 | .oval = VERIFY_SHA256, | |
958 | .help = "Use sha256 checksums for verification", | |
959 | }, | |
960 | { .ival = "sha512", | |
961 | .oval = VERIFY_SHA512, | |
962 | .help = "Use sha512 checksums for verification", | |
963 | }, | |
7437ee87 SL |
964 | { .ival = "meta", |
965 | .oval = VERIFY_META, | |
966 | .help = "Use io information", | |
967 | }, | |
36690c9b JA |
968 | { |
969 | .ival = "null", | |
970 | .oval = VERIFY_NULL, | |
971 | .help = "Pretend to verify", | |
972 | }, | |
214e1eca JA |
973 | }, |
974 | }, | |
005c565a JA |
975 | { |
976 | .name = "do_verify", | |
68e1f29a | 977 | .type = FIO_OPT_BOOL, |
005c565a JA |
978 | .off1 = td_var_offset(do_verify), |
979 | .help = "Run verification stage after write", | |
980 | .def = "1", | |
981 | .parent = "verify", | |
982 | }, | |
160b966d JA |
983 | { |
984 | .name = "verifysort", | |
985 | .type = FIO_OPT_BOOL, | |
986 | .off1 = td_var_offset(verifysort), | |
987 | .help = "Sort written verify blocks for read back", | |
988 | .def = "1", | |
c83f2df1 | 989 | .parent = "verify", |
160b966d | 990 | }, |
3f9f4e26 | 991 | { |
a59e170d | 992 | .name = "verify_interval", |
3f9f4e26 | 993 | .type = FIO_OPT_STR_VAL_INT, |
a59e170d | 994 | .off1 = td_var_offset(verify_interval), |
819a9680 | 995 | .minval = 2 * sizeof(struct verify_header), |
a59e170d | 996 | .help = "Store verify buffer header every N bytes", |
afdf9352 | 997 | .parent = "verify", |
3f9f4e26 | 998 | }, |
546a9142 | 999 | { |
a59e170d | 1000 | .name = "verify_offset", |
546a9142 | 1001 | .type = FIO_OPT_STR_VAL_INT, |
a59e170d | 1002 | .help = "Offset verify header location by N bytes", |
546a9142 | 1003 | .def = "0", |
5ec10eaa | 1004 | .cb = str_verify_offset_cb, |
afdf9352 | 1005 | .parent = "verify", |
546a9142 | 1006 | }, |
e28218f3 SL |
1007 | { |
1008 | .name = "verify_pattern", | |
1009 | .type = FIO_OPT_INT, | |
1010 | .cb = str_verify_pattern_cb, | |
1011 | .help = "Fill pattern for IO buffers", | |
1012 | .parent = "verify", | |
1013 | }, | |
a12a3b4d JA |
1014 | { |
1015 | .name = "verify_fatal", | |
68e1f29a | 1016 | .type = FIO_OPT_BOOL, |
a12a3b4d JA |
1017 | .off1 = td_var_offset(verify_fatal), |
1018 | .def = "0", | |
1019 | .help = "Exit on a single verify failure, don't continue", | |
1020 | .parent = "verify", | |
1021 | }, | |
214e1eca JA |
1022 | { |
1023 | .name = "write_iolog", | |
1024 | .type = FIO_OPT_STR_STORE, | |
1025 | .off1 = td_var_offset(write_iolog_file), | |
1026 | .help = "Store IO pattern to file", | |
1027 | }, | |
1028 | { | |
1029 | .name = "read_iolog", | |
1030 | .type = FIO_OPT_STR_STORE, | |
1031 | .off1 = td_var_offset(read_iolog_file), | |
1032 | .help = "Playback IO pattern from file", | |
1033 | }, | |
1034 | { | |
1035 | .name = "exec_prerun", | |
1036 | .type = FIO_OPT_STR_STORE, | |
1037 | .off1 = td_var_offset(exec_prerun), | |
1038 | .help = "Execute this file prior to running job", | |
1039 | }, | |
1040 | { | |
1041 | .name = "exec_postrun", | |
1042 | .type = FIO_OPT_STR_STORE, | |
1043 | .off1 = td_var_offset(exec_postrun), | |
1044 | .help = "Execute this file after running job", | |
1045 | }, | |
1046 | #ifdef FIO_HAVE_IOSCHED_SWITCH | |
1047 | { | |
1048 | .name = "ioscheduler", | |
1049 | .type = FIO_OPT_STR_STORE, | |
1050 | .off1 = td_var_offset(ioscheduler), | |
1051 | .help = "Use this IO scheduler on the backing device", | |
1052 | }, | |
1053 | #endif | |
1054 | { | |
1055 | .name = "zonesize", | |
1056 | .type = FIO_OPT_STR_VAL, | |
1057 | .off1 = td_var_offset(zone_size), | |
1058 | .help = "Give size of an IO zone", | |
1059 | .def = "0", | |
1060 | }, | |
1061 | { | |
1062 | .name = "zoneskip", | |
1063 | .type = FIO_OPT_STR_VAL, | |
1064 | .off1 = td_var_offset(zone_skip), | |
1065 | .help = "Space between IO zones", | |
1066 | .def = "0", | |
1067 | }, | |
1068 | { | |
1069 | .name = "lockmem", | |
1070 | .type = FIO_OPT_STR_VAL, | |
1071 | .cb = str_lockmem_cb, | |
1072 | .help = "Lock down this amount of memory", | |
1073 | .def = "0", | |
1074 | }, | |
214e1eca JA |
1075 | { |
1076 | .name = "rwmixread", | |
1077 | .type = FIO_OPT_INT, | |
cb499fc4 | 1078 | .cb = str_rwmix_read_cb, |
214e1eca JA |
1079 | .maxval = 100, |
1080 | .help = "Percentage of mixed workload that is reads", | |
1081 | .def = "50", | |
1082 | }, | |
1083 | { | |
1084 | .name = "rwmixwrite", | |
1085 | .type = FIO_OPT_INT, | |
cb499fc4 | 1086 | .cb = str_rwmix_write_cb, |
214e1eca JA |
1087 | .maxval = 100, |
1088 | .help = "Percentage of mixed workload that is writes", | |
1089 | .def = "50", | |
1090 | }, | |
afdf9352 JA |
1091 | { |
1092 | .name = "rwmixcycle", | |
15ca150e | 1093 | .type = FIO_OPT_DEPRECATED, |
afdf9352 | 1094 | }, |
214e1eca JA |
1095 | { |
1096 | .name = "nice", | |
1097 | .type = FIO_OPT_INT, | |
1098 | .off1 = td_var_offset(nice), | |
1099 | .help = "Set job CPU nice value", | |
1100 | .minval = -19, | |
1101 | .maxval = 20, | |
1102 | .def = "0", | |
1103 | }, | |
1104 | #ifdef FIO_HAVE_IOPRIO | |
1105 | { | |
1106 | .name = "prio", | |
1107 | .type = FIO_OPT_INT, | |
1108 | .cb = str_prio_cb, | |
1109 | .help = "Set job IO priority value", | |
1110 | .minval = 0, | |
1111 | .maxval = 7, | |
1112 | }, | |
1113 | { | |
1114 | .name = "prioclass", | |
1115 | .type = FIO_OPT_INT, | |
1116 | .cb = str_prioclass_cb, | |
1117 | .help = "Set job IO priority class", | |
1118 | .minval = 0, | |
1119 | .maxval = 3, | |
1120 | }, | |
1121 | #endif | |
1122 | { | |
1123 | .name = "thinktime", | |
1124 | .type = FIO_OPT_INT, | |
1125 | .off1 = td_var_offset(thinktime), | |
1126 | .help = "Idle time between IO buffers (usec)", | |
1127 | .def = "0", | |
1128 | }, | |
1129 | { | |
1130 | .name = "thinktime_spin", | |
1131 | .type = FIO_OPT_INT, | |
1132 | .off1 = td_var_offset(thinktime_spin), | |
1133 | .help = "Start think time by spinning this amount (usec)", | |
1134 | .def = "0", | |
afdf9352 | 1135 | .parent = "thinktime", |
214e1eca JA |
1136 | }, |
1137 | { | |
1138 | .name = "thinktime_blocks", | |
1139 | .type = FIO_OPT_INT, | |
1140 | .off1 = td_var_offset(thinktime_blocks), | |
1141 | .help = "IO buffer period between 'thinktime'", | |
1142 | .def = "1", | |
afdf9352 | 1143 | .parent = "thinktime", |
214e1eca JA |
1144 | }, |
1145 | { | |
1146 | .name = "rate", | |
1147 | .type = FIO_OPT_INT, | |
1148 | .off1 = td_var_offset(rate), | |
1149 | .help = "Set bandwidth rate", | |
1150 | }, | |
1151 | { | |
1152 | .name = "ratemin", | |
1153 | .type = FIO_OPT_INT, | |
1154 | .off1 = td_var_offset(ratemin), | |
4e991c23 | 1155 | .help = "Job must meet this rate or it will be shutdown", |
afdf9352 | 1156 | .parent = "rate", |
4e991c23 JA |
1157 | }, |
1158 | { | |
1159 | .name = "rate_iops", | |
1160 | .type = FIO_OPT_INT, | |
1161 | .off1 = td_var_offset(rate_iops), | |
1162 | .help = "Limit IO used to this number of IO operations/sec", | |
1163 | }, | |
1164 | { | |
1165 | .name = "rate_iops_min", | |
1166 | .type = FIO_OPT_INT, | |
1167 | .off1 = td_var_offset(rate_iops_min), | |
1168 | .help = "Job must meet this rate or it will be shutdown", | |
afdf9352 | 1169 | .parent = "rate_iops", |
214e1eca JA |
1170 | }, |
1171 | { | |
1172 | .name = "ratecycle", | |
1173 | .type = FIO_OPT_INT, | |
1174 | .off1 = td_var_offset(ratecycle), | |
1175 | .help = "Window average for rate limits (msec)", | |
1176 | .def = "1000", | |
afdf9352 | 1177 | .parent = "rate", |
214e1eca JA |
1178 | }, |
1179 | { | |
1180 | .name = "invalidate", | |
1181 | .type = FIO_OPT_BOOL, | |
1182 | .off1 = td_var_offset(invalidate_cache), | |
1183 | .help = "Invalidate buffer/page cache prior to running job", | |
1184 | .def = "1", | |
1185 | }, | |
1186 | { | |
1187 | .name = "sync", | |
1188 | .type = FIO_OPT_BOOL, | |
1189 | .off1 = td_var_offset(sync_io), | |
1190 | .help = "Use O_SYNC for buffered writes", | |
1191 | .def = "0", | |
67a1000f | 1192 | .parent = "buffered", |
214e1eca JA |
1193 | }, |
1194 | { | |
1195 | .name = "bwavgtime", | |
1196 | .type = FIO_OPT_INT, | |
1197 | .off1 = td_var_offset(bw_avg_time), | |
5ec10eaa JA |
1198 | .help = "Time window over which to calculate bandwidth" |
1199 | " (msec)", | |
214e1eca JA |
1200 | .def = "500", |
1201 | }, | |
1202 | { | |
1203 | .name = "create_serialize", | |
1204 | .type = FIO_OPT_BOOL, | |
1205 | .off1 = td_var_offset(create_serialize), | |
1206 | .help = "Serialize creating of job files", | |
1207 | .def = "1", | |
1208 | }, | |
1209 | { | |
1210 | .name = "create_fsync", | |
1211 | .type = FIO_OPT_BOOL, | |
1212 | .off1 = td_var_offset(create_fsync), | |
1213 | .help = "Fsync file after creation", | |
1214 | .def = "1", | |
1215 | }, | |
1216 | { | |
1217 | .name = "cpuload", | |
1218 | .type = FIO_OPT_INT, | |
1219 | .off1 = td_var_offset(cpuload), | |
1220 | .help = "Use this percentage of CPU", | |
1221 | }, | |
1222 | { | |
1223 | .name = "cpuchunks", | |
1224 | .type = FIO_OPT_INT, | |
1225 | .off1 = td_var_offset(cpucycle), | |
1226 | .help = "Length of the CPU burn cycles (usecs)", | |
1227 | .def = "50000", | |
67a1000f | 1228 | .parent = "cpuload", |
214e1eca JA |
1229 | }, |
1230 | #ifdef FIO_HAVE_CPU_AFFINITY | |
1231 | { | |
1232 | .name = "cpumask", | |
1233 | .type = FIO_OPT_INT, | |
1234 | .cb = str_cpumask_cb, | |
1235 | .help = "CPU affinity mask", | |
1236 | }, | |
d2e268b0 JA |
1237 | { |
1238 | .name = "cpus_allowed", | |
1239 | .type = FIO_OPT_STR, | |
1240 | .cb = str_cpus_allowed_cb, | |
1241 | .help = "Set CPUs allowed", | |
1242 | }, | |
214e1eca JA |
1243 | #endif |
1244 | { | |
1245 | .name = "end_fsync", | |
1246 | .type = FIO_OPT_BOOL, | |
1247 | .off1 = td_var_offset(end_fsync), | |
1248 | .help = "Include fsync at the end of job", | |
1249 | .def = "0", | |
1250 | }, | |
1251 | { | |
1252 | .name = "fsync_on_close", | |
1253 | .type = FIO_OPT_BOOL, | |
1254 | .off1 = td_var_offset(fsync_on_close), | |
1255 | .help = "fsync files on close", | |
1256 | .def = "0", | |
1257 | }, | |
1258 | { | |
1259 | .name = "unlink", | |
1260 | .type = FIO_OPT_BOOL, | |
1261 | .off1 = td_var_offset(unlink), | |
1262 | .help = "Unlink created files after job has completed", | |
1263 | .def = "0", | |
1264 | }, | |
1265 | { | |
1266 | .name = "exitall", | |
1267 | .type = FIO_OPT_STR_SET, | |
1268 | .cb = str_exitall_cb, | |
1269 | .help = "Terminate all jobs when one exits", | |
1270 | }, | |
1271 | { | |
1272 | .name = "stonewall", | |
1273 | .type = FIO_OPT_STR_SET, | |
1274 | .off1 = td_var_offset(stonewall), | |
1275 | .help = "Insert a hard barrier between this job and previous", | |
1276 | }, | |
b3d62a75 JA |
1277 | { |
1278 | .name = "new_group", | |
1279 | .type = FIO_OPT_STR_SET, | |
1280 | .off1 = td_var_offset(new_group), | |
1281 | .help = "Mark the start of a new group (for reporting)", | |
1282 | }, | |
214e1eca JA |
1283 | { |
1284 | .name = "thread", | |
1285 | .type = FIO_OPT_STR_SET, | |
1286 | .off1 = td_var_offset(use_thread), | |
1287 | .help = "Use threads instead of forks", | |
1288 | }, | |
1289 | { | |
1290 | .name = "write_bw_log", | |
e3cedca7 | 1291 | .type = FIO_OPT_STR, |
214e1eca | 1292 | .off1 = td_var_offset(write_bw_log), |
e3cedca7 | 1293 | .cb = str_write_bw_log_cb, |
214e1eca JA |
1294 | .help = "Write log of bandwidth during run", |
1295 | }, | |
1296 | { | |
1297 | .name = "write_lat_log", | |
e3cedca7 | 1298 | .type = FIO_OPT_STR, |
214e1eca | 1299 | .off1 = td_var_offset(write_lat_log), |
e3cedca7 | 1300 | .cb = str_write_lat_log_cb, |
214e1eca JA |
1301 | .help = "Write log of latency during run", |
1302 | }, | |
1303 | { | |
1304 | .name = "hugepage-size", | |
357f618e | 1305 | .type = FIO_OPT_STR_VAL_INT, |
214e1eca JA |
1306 | .off1 = td_var_offset(hugepage_size), |
1307 | .help = "When using hugepages, specify size of each page", | |
1308 | .def = __stringify(FIO_HUGE_PAGE), | |
1309 | }, | |
1310 | { | |
1311 | .name = "group_reporting", | |
1312 | .type = FIO_OPT_STR_SET, | |
1313 | .off1 = td_var_offset(group_reporting), | |
1314 | .help = "Do reporting on a per-group basis", | |
1315 | }, | |
e9459e5a JA |
1316 | { |
1317 | .name = "zero_buffers", | |
1318 | .type = FIO_OPT_STR_SET, | |
1319 | .off1 = td_var_offset(zero_buffers), | |
1320 | .help = "Init IO buffers to all zeroes", | |
1321 | }, | |
5973cafb JA |
1322 | { |
1323 | .name = "refill_buffers", | |
1324 | .type = FIO_OPT_STR_SET, | |
1325 | .off1 = td_var_offset(refill_buffers), | |
1326 | .help = "Refill IO buffers on every IO submit", | |
1327 | }, | |
0a839f30 JA |
1328 | #ifdef FIO_HAVE_DISK_UTIL |
1329 | { | |
1330 | .name = "disk_util", | |
1331 | .type = FIO_OPT_BOOL, | |
1332 | .off1 = td_var_offset(do_disk_util), | |
f66ab3c8 | 1333 | .help = "Log disk utilization statistics", |
0a839f30 JA |
1334 | .def = "1", |
1335 | }, | |
1336 | #endif | |
993bf48b JA |
1337 | { |
1338 | .name = "gtod_reduce", | |
1339 | .type = FIO_OPT_BOOL, | |
1340 | .help = "Greatly reduce number of gettimeofday() calls", | |
1341 | .cb = str_gtod_reduce_cb, | |
1342 | .def = "0", | |
1343 | }, | |
9520ebb9 JA |
1344 | { |
1345 | .name = "disable_clat", | |
1346 | .type = FIO_OPT_BOOL, | |
1347 | .off1 = td_var_offset(disable_clat), | |
1348 | .help = "Disable completion latency numbers", | |
993bf48b | 1349 | .parent = "gtod_reduce", |
9520ebb9 JA |
1350 | .def = "0", |
1351 | }, | |
1352 | { | |
1353 | .name = "disable_slat", | |
1354 | .type = FIO_OPT_BOOL, | |
1355 | .off1 = td_var_offset(disable_slat), | |
1356 | .help = "Disable submissionn latency numbers", | |
993bf48b | 1357 | .parent = "gtod_reduce", |
9520ebb9 JA |
1358 | .def = "0", |
1359 | }, | |
1360 | { | |
1361 | .name = "disable_bw_measurement", | |
1362 | .type = FIO_OPT_BOOL, | |
1363 | .off1 = td_var_offset(disable_bw), | |
1364 | .help = "Disable bandwidth logging", | |
993bf48b | 1365 | .parent = "gtod_reduce", |
9520ebb9 JA |
1366 | .def = "0", |
1367 | }, | |
214e1eca JA |
1368 | { |
1369 | .name = NULL, | |
1370 | }, | |
1371 | }; | |
1372 | ||
1373 | void fio_options_dup_and_init(struct option *long_options) | |
1374 | { | |
1375 | struct fio_option *o; | |
1376 | unsigned int i; | |
1377 | ||
1378 | options_init(options); | |
1379 | ||
1380 | i = 0; | |
1381 | while (long_options[i].name) | |
1382 | i++; | |
1383 | ||
1384 | o = &options[0]; | |
1385 | while (o->name) { | |
5921e80c | 1386 | long_options[i].name = (char *) o->name; |
214e1eca JA |
1387 | long_options[i].val = FIO_GETOPT_JOB; |
1388 | if (o->type == FIO_OPT_STR_SET) | |
1389 | long_options[i].has_arg = no_argument; | |
1390 | else | |
1391 | long_options[i].has_arg = required_argument; | |
1392 | ||
1393 | i++; | |
1394 | o++; | |
1395 | assert(i < FIO_NR_OPTIONS); | |
1396 | } | |
1397 | } | |
1398 | ||
3b8b7135 | 1399 | int fio_options_parse(struct thread_data *td, char **opts, int num_opts) |
214e1eca | 1400 | { |
3b8b7135 JA |
1401 | int i, ret; |
1402 | ||
1403 | sort_options(opts, options, num_opts); | |
1404 | ||
1405 | for (ret = 0, i = 0; i < num_opts; i++) | |
1406 | ret |= parse_option(opts[i], options, td); | |
1407 | ||
1408 | return ret; | |
214e1eca JA |
1409 | } |
1410 | ||
1411 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) | |
1412 | { | |
1413 | return parse_cmd_option(opt, val, options, td); | |
1414 | } | |
1415 | ||
1416 | void fio_fill_default_options(struct thread_data *td) | |
1417 | { | |
1418 | fill_default_options(td, options); | |
1419 | } | |
1420 | ||
1421 | int fio_show_option_help(const char *opt) | |
1422 | { | |
1423 | return show_cmd_help(options, opt); | |
1424 | } | |
d23bb327 JA |
1425 | |
1426 | static void __options_mem(struct thread_data *td, int alloc) | |
1427 | { | |
1428 | struct thread_options *o = &td->o; | |
1429 | struct fio_option *opt; | |
1430 | char **ptr; | |
1431 | int i; | |
1432 | ||
1433 | for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) { | |
1434 | if (opt->type != FIO_OPT_STR_STORE) | |
1435 | continue; | |
1436 | ||
1437 | ptr = (void *) o + opt->off1; | |
1438 | if (*ptr) { | |
1439 | if (alloc) | |
1440 | *ptr = strdup(*ptr); | |
1441 | else { | |
1442 | free(*ptr); | |
1443 | *ptr = NULL; | |
1444 | } | |
1445 | } | |
1446 | } | |
1447 | } | |
1448 | ||
1449 | /* | |
1450 | * dupe FIO_OPT_STR_STORE options | |
1451 | */ | |
1452 | void options_mem_dupe(struct thread_data *td) | |
1453 | { | |
1454 | __options_mem(td, 1); | |
1455 | } | |
1456 | ||
22d66213 | 1457 | void options_mem_free(struct thread_data fio_unused *td) |
d23bb327 | 1458 | { |
22d66213 | 1459 | #if 0 |
d23bb327 | 1460 | __options_mem(td, 0); |
22d66213 | 1461 | #endif |
d23bb327 | 1462 | } |