Leftover debug printf()
[fio.git] / options.c
CommitLineData
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>
8
9#include "fio.h"
10#include "parse.h"
11
2dc1bbeb 12#define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var)
214e1eca
JA
13
14/*
15 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
16 */
17static char *get_opt_postfix(const char *str)
18{
19 char *p = strstr(str, ":");
20
21 if (!p)
22 return NULL;
23
24 p++;
25 strip_blank_front(&p);
26 strip_blank_end(p);
27 return strdup(p);
28}
29
211097b2
JA
30static int str_rw_cb(void *data, const char *str)
31{
32 struct thread_data *td = data;
33 char *nr = get_opt_postfix(str);
34
35 td->o.ddir_nr = 0;
36 if (nr)
37 td->o.ddir_nr = atoi(nr);
38
211097b2
JA
39 return 0;
40}
41
214e1eca
JA
42static int str_mem_cb(void *data, const char *mem)
43{
44 struct thread_data *td = data;
45
2dc1bbeb 46 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
214e1eca 47 td->mmapfile = get_opt_postfix(mem);
2dc1bbeb 48 if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
214e1eca
JA
49 log_err("fio: mmaphuge:/path/to/file\n");
50 return 1;
51 }
52 }
53
54 return 0;
55}
56
57static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
58{
59 mlock_size = *val;
60 return 0;
61}
62
63#ifdef FIO_HAVE_IOPRIO
64static int str_prioclass_cb(void *data, unsigned int *val)
65{
66 struct thread_data *td = data;
67
68 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
69 return 0;
70}
71
72static int str_prio_cb(void *data, unsigned int *val)
73{
74 struct thread_data *td = data;
75
76 td->ioprio |= *val;
77 return 0;
78}
79#endif
80
81static int str_exitall_cb(void)
82{
83 exitall_on_terminate = 1;
84 return 0;
85}
86
87static void fill_cpu_mask(os_cpu_mask_t cpumask, int cpu)
88{
89#ifdef FIO_HAVE_CPU_AFFINITY
90 unsigned int i;
91
92 CPU_ZERO(&cpumask);
93
94 for (i = 0; i < sizeof(int) * 8; i++) {
95 if ((1 << i) & cpu)
96 CPU_SET(i, &cpumask);
97 }
98#endif
99}
100
101static int str_cpumask_cb(void *data, unsigned int *val)
102{
103 struct thread_data *td = data;
104
2dc1bbeb 105 fill_cpu_mask(td->o.cpumask, *val);
214e1eca
JA
106 return 0;
107}
108
109static int str_fst_cb(void *data, const char *str)
110{
111 struct thread_data *td = data;
112 char *nr = get_opt_postfix(str);
113
114 td->file_service_nr = 1;
115 if (nr)
116 td->file_service_nr = atoi(nr);
117
118 return 0;
119}
120
121static int str_filename_cb(void *data, const char *input)
122{
123 struct thread_data *td = data;
124 char *fname, *str, *p;
125
126 p = str = strdup(input);
127
128 strip_blank_front(&str);
129 strip_blank_end(str);
130
131 if (!td->files_index)
2dc1bbeb 132 td->o.nr_files = 0;
214e1eca
JA
133
134 while ((fname = strsep(&str, ":")) != NULL) {
135 if (!strlen(fname))
136 break;
137 add_file(td, fname);
2dc1bbeb 138 td->o.nr_files++;
214e1eca
JA
139 }
140
141 free(p);
142 return 0;
143}
144
145static int str_directory_cb(void *data, const char fio_unused *str)
146{
147 struct thread_data *td = data;
148 struct stat sb;
149
2dc1bbeb
JA
150 if (lstat(td->o.directory, &sb) < 0) {
151 log_err("fio: %s is not a directory\n", td->o.directory);
214e1eca
JA
152 td_verror(td, errno, "lstat");
153 return 1;
154 }
155 if (!S_ISDIR(sb.st_mode)) {
2dc1bbeb 156 log_err("fio: %s is not a directory\n", td->o.directory);
214e1eca
JA
157 return 1;
158 }
159
160 return 0;
161}
162
163static int str_opendir_cb(void *data, const char fio_unused *str)
164{
165 struct thread_data *td = data;
166
167 if (!td->files_index)
2dc1bbeb 168 td->o.nr_files = 0;
214e1eca 169
2dc1bbeb 170 return add_dir_files(td, td->o.opendir);
214e1eca
JA
171}
172
173
174#define __stringify_1(x) #x
175#define __stringify(x) __stringify_1(x)
176
177/*
178 * Map of job/command line options
179 */
180static struct fio_option options[] = {
181 {
182 .name = "description",
183 .type = FIO_OPT_STR_STORE,
184 .off1 = td_var_offset(description),
185 .help = "Text job description",
186 },
187 {
188 .name = "name",
189 .type = FIO_OPT_STR_STORE,
190 .off1 = td_var_offset(name),
191 .help = "Name of this job",
192 },
193 {
194 .name = "directory",
195 .type = FIO_OPT_STR_STORE,
196 .off1 = td_var_offset(directory),
197 .cb = str_directory_cb,
198 .help = "Directory to store files in",
199 },
200 {
201 .name = "filename",
202 .type = FIO_OPT_STR_STORE,
203 .off1 = td_var_offset(filename),
204 .cb = str_filename_cb,
205 .help = "File(s) to use for the workload",
206 },
207 {
208 .name = "opendir",
209 .type = FIO_OPT_STR_STORE,
210 .off1 = td_var_offset(opendir),
211 .cb = str_opendir_cb,
212 .help = "Recursively add files from this directory and down",
213 },
214 {
215 .name = "rw",
d3aad8f2 216 .alias = "readwrite",
214e1eca 217 .type = FIO_OPT_STR,
211097b2 218 .cb = str_rw_cb,
214e1eca
JA
219 .off1 = td_var_offset(td_ddir),
220 .help = "IO direction",
221 .def = "read",
222 .posval = {
223 { .ival = "read",
224 .oval = TD_DDIR_READ,
225 .help = "Sequential read",
226 },
227 { .ival = "write",
228 .oval = TD_DDIR_WRITE,
229 .help = "Sequential write",
230 },
231 { .ival = "randread",
232 .oval = TD_DDIR_RANDREAD,
233 .help = "Random read",
234 },
235 { .ival = "randwrite",
236 .oval = TD_DDIR_RANDWRITE,
237 .help = "Random write",
238 },
239 { .ival = "rw",
240 .oval = TD_DDIR_RW,
241 .help = "Sequential read and write mix",
242 },
243 { .ival = "randrw",
244 .oval = TD_DDIR_RANDRW,
245 .help = "Random read and write mix"
246 },
247 },
248 },
249 {
250 .name = "ioengine",
251 .type = FIO_OPT_STR_STORE,
252 .off1 = td_var_offset(ioengine),
253 .help = "IO engine to use",
254 .def = "sync",
255 .posval = {
256 { .ival = "sync",
257 .help = "Use read/write",
258 },
259#ifdef FIO_HAVE_LIBAIO
260 { .ival = "libaio",
261 .help = "Linux native asynchronous IO",
262 },
263#endif
264#ifdef FIO_HAVE_POSIXAIO
265 { .ival = "posixaio",
266 .help = "POSIX asynchronous IO",
267 },
268#endif
269 { .ival = "mmap",
270 .help = "Memory mapped IO",
271 },
272#ifdef FIO_HAVE_SPLICE
273 { .ival = "splice",
274 .help = "splice/vmsplice based IO",
275 },
276#endif
277#ifdef FIO_HAVE_SGIO
278 { .ival = "sg",
279 .help = "SCSI generic v3 IO",
280 },
281#endif
282 { .ival = "null",
283 .help = "Testing engine (no data transfer)",
284 },
285 { .ival = "net",
286 .help = "Network IO",
287 },
288#ifdef FIO_HAVE_SYSLET
289 { .ival = "syslet-rw",
290 .help = "syslet enabled async pread/pwrite IO",
291 },
292#endif
293 { .ival = "cpuio",
294 .help = "CPU cycler burner engine",
295 },
b8c82a46
JA
296#ifdef FIO_HAVE_GUASI
297 { .ival = "guasi",
298 .help = "GUASI IO engine",
299 },
300#endif
214e1eca
JA
301 { .ival = "external",
302 .help = "Load external engine (append name)",
303 },
304 },
305 },
306 {
307 .name = "iodepth",
308 .type = FIO_OPT_INT,
309 .off1 = td_var_offset(iodepth),
310 .help = "Amount of IO buffers to keep in flight",
311 .def = "1",
312 },
313 {
314 .name = "iodepth_batch",
315 .type = FIO_OPT_INT,
316 .off1 = td_var_offset(iodepth_batch),
317 .help = "Number of IO to submit in one go",
318 },
319 {
320 .name = "iodepth_low",
321 .type = FIO_OPT_INT,
322 .off1 = td_var_offset(iodepth_low),
323 .help = "Low water mark for queuing depth",
324 },
325 {
326 .name = "size",
327 .type = FIO_OPT_STR_VAL,
2dc1bbeb 328 .off1 = td_var_offset(size),
214e1eca
JA
329 .help = "Total size of device or files",
330 },
331 {
332 .name = "filesize",
333 .type = FIO_OPT_STR_VAL,
334 .off1 = td_var_offset(file_size_low),
335 .off2 = td_var_offset(file_size_high),
336 .help = "Size of individual files",
337 },
338 {
339 .name = "bs",
d3aad8f2 340 .alias = "blocksize",
214e1eca
JA
341 .type = FIO_OPT_STR_VAL_INT,
342 .off1 = td_var_offset(bs[DDIR_READ]),
343 .off2 = td_var_offset(bs[DDIR_WRITE]),
344 .help = "Block size unit",
345 .def = "4k",
346 },
347 {
348 .name = "bsrange",
d3aad8f2 349 .alias = "blocksize_range",
214e1eca
JA
350 .type = FIO_OPT_RANGE,
351 .off1 = td_var_offset(min_bs[DDIR_READ]),
352 .off2 = td_var_offset(max_bs[DDIR_READ]),
353 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
354 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
355 .help = "Set block size range (in more detail than bs)",
356 },
357 {
358 .name = "bs_unaligned",
d3aad8f2 359 .alias = "blocksize_unaligned",
214e1eca
JA
360 .type = FIO_OPT_STR_SET,
361 .off1 = td_var_offset(bs_unaligned),
362 .help = "Don't sector align IO buffer sizes",
363 },
364 {
365 .name = "offset",
366 .type = FIO_OPT_STR_VAL,
367 .off1 = td_var_offset(start_offset),
368 .help = "Start IO from this offset",
369 .def = "0",
370 },
371 {
372 .name = "randrepeat",
373 .type = FIO_OPT_BOOL,
374 .off1 = td_var_offset(rand_repeatable),
375 .help = "Use repeatable random IO pattern",
376 .def = "1",
377 },
378 {
379 .name = "norandommap",
380 .type = FIO_OPT_STR_SET,
381 .off1 = td_var_offset(norandommap),
382 .help = "Accept potential duplicate random blocks",
383 },
384 {
385 .name = "nrfiles",
386 .type = FIO_OPT_INT,
387 .off1 = td_var_offset(nr_files),
388 .help = "Split job workload between this number of files",
389 .def = "1",
390 },
391 {
392 .name = "openfiles",
393 .type = FIO_OPT_INT,
394 .off1 = td_var_offset(open_files),
395 .help = "Number of files to keep open at the same time",
396 },
397 {
398 .name = "file_service_type",
399 .type = FIO_OPT_STR,
400 .cb = str_fst_cb,
401 .off1 = td_var_offset(file_service_type),
402 .help = "How to select which file to service next",
403 .def = "roundrobin",
404 .posval = {
405 { .ival = "random",
406 .oval = FIO_FSERVICE_RANDOM,
407 .help = "Choose a file at random",
408 },
409 { .ival = "roundrobin",
410 .oval = FIO_FSERVICE_RR,
411 .help = "Round robin select files",
412 },
413 },
414 },
415 {
416 .name = "fsync",
417 .type = FIO_OPT_INT,
418 .off1 = td_var_offset(fsync_blocks),
419 .help = "Issue fsync for writes every given number of blocks",
420 .def = "0",
421 },
422 {
423 .name = "direct",
424 .type = FIO_OPT_BOOL,
425 .off1 = td_var_offset(odirect),
426 .help = "Use O_DIRECT IO (negates buffered)",
427 .def = "0",
428 },
429 {
430 .name = "buffered",
431 .type = FIO_OPT_BOOL,
432 .off1 = td_var_offset(odirect),
433 .neg = 1,
434 .help = "Use buffered IO (negates direct)",
435 .def = "1",
436 },
437 {
438 .name = "overwrite",
439 .type = FIO_OPT_BOOL,
440 .off1 = td_var_offset(overwrite),
441 .help = "When writing, set whether to overwrite current data",
442 .def = "0",
443 },
444 {
445 .name = "loops",
446 .type = FIO_OPT_INT,
447 .off1 = td_var_offset(loops),
448 .help = "Number of times to run the job",
449 .def = "1",
450 },
451 {
452 .name = "numjobs",
453 .type = FIO_OPT_INT,
454 .off1 = td_var_offset(numjobs),
455 .help = "Duplicate this job this many times",
456 .def = "1",
457 },
458 {
459 .name = "startdelay",
460 .type = FIO_OPT_INT,
461 .off1 = td_var_offset(start_delay),
462 .help = "Only start job when this period has passed",
463 .def = "0",
464 },
465 {
466 .name = "runtime",
467 .alias = "timeout",
468 .type = FIO_OPT_STR_VAL_TIME,
469 .off1 = td_var_offset(timeout),
470 .help = "Stop workload when this amount of time has passed",
471 .def = "0",
472 },
473 {
474 .name = "mem",
d3aad8f2 475 .alias = "iomem",
214e1eca
JA
476 .type = FIO_OPT_STR,
477 .cb = str_mem_cb,
478 .off1 = td_var_offset(mem_type),
479 .help = "Backing type for IO buffers",
480 .def = "malloc",
481 .posval = {
482 { .ival = "malloc",
483 .oval = MEM_MALLOC,
484 .help = "Use malloc(3) for IO buffers",
485 },
37c8cdfe
JA
486 { .ival = "shm",
487 .oval = MEM_SHM,
488 .help = "Use shared memory segments for IO buffers",
489 },
214e1eca
JA
490#ifdef FIO_HAVE_HUGETLB
491 { .ival = "shmhuge",
492 .oval = MEM_SHMHUGE,
493 .help = "Like shm, but use huge pages",
494 },
b370e46a 495#endif
37c8cdfe
JA
496 { .ival = "mmap",
497 .oval = MEM_MMAP,
498 .help = "Use mmap(2) (file or anon) for IO buffers",
499 },
214e1eca
JA
500#ifdef FIO_HAVE_HUGETLB
501 { .ival = "mmaphuge",
502 .oval = MEM_MMAPHUGE,
503 .help = "Like mmap, but use huge pages",
504 },
505#endif
506 },
507 },
508 {
509 .name = "verify",
510 .type = FIO_OPT_STR,
511 .off1 = td_var_offset(verify),
512 .help = "Verify data written",
513 .def = "0",
514 .posval = {
515 { .ival = "0",
516 .oval = VERIFY_NONE,
517 .help = "Don't do IO verification",
518 },
519 { .ival = "crc32",
520 .oval = VERIFY_CRC32,
521 .help = "Use crc32 checksums for verification",
522 },
523 { .ival = "md5",
524 .oval = VERIFY_MD5,
525 .help = "Use md5 checksums for verification",
526 },
527 },
528 },
529 {
530 .name = "write_iolog",
531 .type = FIO_OPT_STR_STORE,
532 .off1 = td_var_offset(write_iolog_file),
533 .help = "Store IO pattern to file",
534 },
535 {
536 .name = "read_iolog",
537 .type = FIO_OPT_STR_STORE,
538 .off1 = td_var_offset(read_iolog_file),
539 .help = "Playback IO pattern from file",
540 },
541 {
542 .name = "exec_prerun",
543 .type = FIO_OPT_STR_STORE,
544 .off1 = td_var_offset(exec_prerun),
545 .help = "Execute this file prior to running job",
546 },
547 {
548 .name = "exec_postrun",
549 .type = FIO_OPT_STR_STORE,
550 .off1 = td_var_offset(exec_postrun),
551 .help = "Execute this file after running job",
552 },
553#ifdef FIO_HAVE_IOSCHED_SWITCH
554 {
555 .name = "ioscheduler",
556 .type = FIO_OPT_STR_STORE,
557 .off1 = td_var_offset(ioscheduler),
558 .help = "Use this IO scheduler on the backing device",
559 },
560#endif
561 {
562 .name = "zonesize",
563 .type = FIO_OPT_STR_VAL,
564 .off1 = td_var_offset(zone_size),
565 .help = "Give size of an IO zone",
566 .def = "0",
567 },
568 {
569 .name = "zoneskip",
570 .type = FIO_OPT_STR_VAL,
571 .off1 = td_var_offset(zone_skip),
572 .help = "Space between IO zones",
573 .def = "0",
574 },
575 {
576 .name = "lockmem",
577 .type = FIO_OPT_STR_VAL,
578 .cb = str_lockmem_cb,
579 .help = "Lock down this amount of memory",
580 .def = "0",
581 },
582 {
583 .name = "rwmixcycle",
584 .type = FIO_OPT_INT,
585 .off1 = td_var_offset(rwmixcycle),
586 .help = "Cycle period for mixed read/write workloads (msec)",
587 .def = "500",
588 },
589 {
590 .name = "rwmixread",
591 .type = FIO_OPT_INT,
e47f799f 592 .off1 = td_var_offset(rwmix[DDIR_READ]),
214e1eca
JA
593 .maxval = 100,
594 .help = "Percentage of mixed workload that is reads",
595 .def = "50",
596 },
597 {
598 .name = "rwmixwrite",
599 .type = FIO_OPT_INT,
e47f799f 600 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
214e1eca
JA
601 .maxval = 100,
602 .help = "Percentage of mixed workload that is writes",
603 .def = "50",
604 },
605 {
606 .name = "nice",
607 .type = FIO_OPT_INT,
608 .off1 = td_var_offset(nice),
609 .help = "Set job CPU nice value",
610 .minval = -19,
611 .maxval = 20,
612 .def = "0",
613 },
614#ifdef FIO_HAVE_IOPRIO
615 {
616 .name = "prio",
617 .type = FIO_OPT_INT,
618 .cb = str_prio_cb,
619 .help = "Set job IO priority value",
620 .minval = 0,
621 .maxval = 7,
622 },
623 {
624 .name = "prioclass",
625 .type = FIO_OPT_INT,
626 .cb = str_prioclass_cb,
627 .help = "Set job IO priority class",
628 .minval = 0,
629 .maxval = 3,
630 },
631#endif
632 {
633 .name = "thinktime",
634 .type = FIO_OPT_INT,
635 .off1 = td_var_offset(thinktime),
636 .help = "Idle time between IO buffers (usec)",
637 .def = "0",
638 },
639 {
640 .name = "thinktime_spin",
641 .type = FIO_OPT_INT,
642 .off1 = td_var_offset(thinktime_spin),
643 .help = "Start think time by spinning this amount (usec)",
644 .def = "0",
645 },
646 {
647 .name = "thinktime_blocks",
648 .type = FIO_OPT_INT,
649 .off1 = td_var_offset(thinktime_blocks),
650 .help = "IO buffer period between 'thinktime'",
651 .def = "1",
652 },
653 {
654 .name = "rate",
655 .type = FIO_OPT_INT,
656 .off1 = td_var_offset(rate),
657 .help = "Set bandwidth rate",
658 },
659 {
660 .name = "ratemin",
661 .type = FIO_OPT_INT,
662 .off1 = td_var_offset(ratemin),
4e991c23
JA
663 .help = "Job must meet this rate or it will be shutdown",
664 },
665 {
666 .name = "rate_iops",
667 .type = FIO_OPT_INT,
668 .off1 = td_var_offset(rate_iops),
669 .help = "Limit IO used to this number of IO operations/sec",
670 },
671 {
672 .name = "rate_iops_min",
673 .type = FIO_OPT_INT,
674 .off1 = td_var_offset(rate_iops_min),
675 .help = "Job must meet this rate or it will be shutdown",
214e1eca
JA
676 },
677 {
678 .name = "ratecycle",
679 .type = FIO_OPT_INT,
680 .off1 = td_var_offset(ratecycle),
681 .help = "Window average for rate limits (msec)",
682 .def = "1000",
683 },
684 {
685 .name = "invalidate",
686 .type = FIO_OPT_BOOL,
687 .off1 = td_var_offset(invalidate_cache),
688 .help = "Invalidate buffer/page cache prior to running job",
689 .def = "1",
690 },
691 {
692 .name = "sync",
693 .type = FIO_OPT_BOOL,
694 .off1 = td_var_offset(sync_io),
695 .help = "Use O_SYNC for buffered writes",
696 .def = "0",
697 },
698 {
699 .name = "bwavgtime",
700 .type = FIO_OPT_INT,
701 .off1 = td_var_offset(bw_avg_time),
702 .help = "Time window over which to calculate bandwidth (msec)",
703 .def = "500",
704 },
705 {
706 .name = "create_serialize",
707 .type = FIO_OPT_BOOL,
708 .off1 = td_var_offset(create_serialize),
709 .help = "Serialize creating of job files",
710 .def = "1",
711 },
712 {
713 .name = "create_fsync",
714 .type = FIO_OPT_BOOL,
715 .off1 = td_var_offset(create_fsync),
716 .help = "Fsync file after creation",
717 .def = "1",
718 },
719 {
720 .name = "cpuload",
721 .type = FIO_OPT_INT,
722 .off1 = td_var_offset(cpuload),
723 .help = "Use this percentage of CPU",
724 },
725 {
726 .name = "cpuchunks",
727 .type = FIO_OPT_INT,
728 .off1 = td_var_offset(cpucycle),
729 .help = "Length of the CPU burn cycles (usecs)",
730 .def = "50000",
731 },
732#ifdef FIO_HAVE_CPU_AFFINITY
733 {
734 .name = "cpumask",
735 .type = FIO_OPT_INT,
736 .cb = str_cpumask_cb,
737 .help = "CPU affinity mask",
738 },
739#endif
740 {
741 .name = "end_fsync",
742 .type = FIO_OPT_BOOL,
743 .off1 = td_var_offset(end_fsync),
744 .help = "Include fsync at the end of job",
745 .def = "0",
746 },
747 {
748 .name = "fsync_on_close",
749 .type = FIO_OPT_BOOL,
750 .off1 = td_var_offset(fsync_on_close),
751 .help = "fsync files on close",
752 .def = "0",
753 },
754 {
755 .name = "unlink",
756 .type = FIO_OPT_BOOL,
757 .off1 = td_var_offset(unlink),
758 .help = "Unlink created files after job has completed",
759 .def = "0",
760 },
761 {
762 .name = "exitall",
763 .type = FIO_OPT_STR_SET,
764 .cb = str_exitall_cb,
765 .help = "Terminate all jobs when one exits",
766 },
767 {
768 .name = "stonewall",
769 .type = FIO_OPT_STR_SET,
770 .off1 = td_var_offset(stonewall),
771 .help = "Insert a hard barrier between this job and previous",
772 },
b3d62a75
JA
773 {
774 .name = "new_group",
775 .type = FIO_OPT_STR_SET,
776 .off1 = td_var_offset(new_group),
777 .help = "Mark the start of a new group (for reporting)",
778 },
214e1eca
JA
779 {
780 .name = "thread",
781 .type = FIO_OPT_STR_SET,
782 .off1 = td_var_offset(use_thread),
783 .help = "Use threads instead of forks",
784 },
785 {
786 .name = "write_bw_log",
787 .type = FIO_OPT_STR_SET,
788 .off1 = td_var_offset(write_bw_log),
789 .help = "Write log of bandwidth during run",
790 },
791 {
792 .name = "write_lat_log",
793 .type = FIO_OPT_STR_SET,
794 .off1 = td_var_offset(write_lat_log),
795 .help = "Write log of latency during run",
796 },
797 {
798 .name = "hugepage-size",
799 .type = FIO_OPT_STR_VAL,
800 .off1 = td_var_offset(hugepage_size),
801 .help = "When using hugepages, specify size of each page",
802 .def = __stringify(FIO_HUGE_PAGE),
803 },
804 {
805 .name = "group_reporting",
806 .type = FIO_OPT_STR_SET,
807 .off1 = td_var_offset(group_reporting),
808 .help = "Do reporting on a per-group basis",
809 },
810 {
811 .name = NULL,
812 },
813};
814
815void fio_options_dup_and_init(struct option *long_options)
816{
817 struct fio_option *o;
818 unsigned int i;
819
820 options_init(options);
821
822 i = 0;
823 while (long_options[i].name)
824 i++;
825
826 o = &options[0];
827 while (o->name) {
828 long_options[i].name = o->name;
829 long_options[i].val = FIO_GETOPT_JOB;
830 if (o->type == FIO_OPT_STR_SET)
831 long_options[i].has_arg = no_argument;
832 else
833 long_options[i].has_arg = required_argument;
834
835 i++;
836 o++;
837 assert(i < FIO_NR_OPTIONS);
838 }
839}
840
841int fio_option_parse(struct thread_data *td, const char *opt)
842{
843 return parse_option(opt, options, td);
844}
845
846int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
847{
848 return parse_cmd_option(opt, val, options, td);
849}
850
851void fio_fill_default_options(struct thread_data *td)
852{
853 fill_default_options(td, options);
854}
855
856int fio_show_option_help(const char *opt)
857{
858 return show_cmd_help(options, opt);
859}