Merge branch 'msys2' of https://github.com/sitsofe/fio into master
[fio.git] / thread_options.h
... / ...
CommitLineData
1#ifndef FIO_THREAD_OPTIONS_H
2#define FIO_THREAD_OPTIONS_H
3
4#include "arch/arch.h"
5#include "os/os.h"
6#include "options.h"
7#include "stat.h"
8#include "gettime.h"
9#include "lib/ieee754.h"
10#include "lib/pattern.h"
11#include "td_error.h"
12
13enum fio_zone_mode {
14 ZONE_MODE_NOT_SPECIFIED = 0,
15 ZONE_MODE_NONE = 1,
16 ZONE_MODE_STRIDED = 2, /* perform I/O in one zone at a time */
17 /* perform I/O across multiple zones simultaneously */
18 ZONE_MODE_ZBD = 3,
19};
20
21/*
22 * What type of allocation to use for io buffers
23 */
24enum fio_memtype {
25 MEM_MALLOC = 0, /* ordinary malloc */
26 MEM_SHM, /* use shared memory segments */
27 MEM_SHMHUGE, /* use shared memory segments with huge pages */
28 MEM_MMAP, /* use anonynomous mmap */
29 MEM_MMAPHUGE, /* memory mapped huge file */
30 MEM_MMAPSHARED, /* use mmap with shared flag */
31 MEM_CUDA_MALLOC,/* use GPU memory */
32};
33
34#define ERROR_STR_MAX 128
35
36#define BSSPLIT_MAX 64
37#define ZONESPLIT_MAX 256
38
39struct bssplit {
40 uint64_t bs;
41 uint32_t perc;
42};
43
44struct zone_split {
45 uint8_t access_perc;
46 uint8_t size_perc;
47 uint8_t pad[6];
48 uint64_t size;
49};
50
51#define NR_OPTS_SZ (FIO_MAX_OPTS / (8 * sizeof(uint64_t)))
52
53#define OPT_MAGIC 0x4f50544e
54
55struct thread_options {
56 int magic;
57 uint64_t set_options[NR_OPTS_SZ];
58 char *description;
59 char *name;
60 char *wait_for;
61 char *directory;
62 char *filename;
63 char *filename_format;
64 char *opendir;
65 char *ioengine;
66 char *ioengine_so_path;
67 char *mmapfile;
68 enum td_ddir td_ddir;
69 unsigned int rw_seq;
70 unsigned int kb_base;
71 unsigned int unit_base;
72 unsigned int ddir_seq_nr;
73 long long ddir_seq_add;
74 unsigned int iodepth;
75 unsigned int iodepth_low;
76 unsigned int iodepth_batch;
77 unsigned int iodepth_batch_complete_min;
78 unsigned int iodepth_batch_complete_max;
79 unsigned int serialize_overlap;
80
81 unsigned int unique_filename;
82
83 unsigned long long size;
84 unsigned long long io_size;
85 unsigned int size_percent;
86 unsigned int io_size_percent;
87 unsigned int fill_device;
88 unsigned int file_append;
89 unsigned long long file_size_low;
90 unsigned long long file_size_high;
91 unsigned long long start_offset;
92 unsigned long long start_offset_align;
93
94 unsigned long long bs[DDIR_RWDIR_CNT];
95 unsigned long long ba[DDIR_RWDIR_CNT];
96 unsigned long long min_bs[DDIR_RWDIR_CNT];
97 unsigned long long max_bs[DDIR_RWDIR_CNT];
98 struct bssplit *bssplit[DDIR_RWDIR_CNT];
99 unsigned int bssplit_nr[DDIR_RWDIR_CNT];
100
101 int *ignore_error[ERROR_TYPE_CNT];
102 unsigned int ignore_error_nr[ERROR_TYPE_CNT];
103 unsigned int error_dump;
104
105 unsigned int nr_files;
106 unsigned int open_files;
107 enum file_lock_mode file_lock_mode;
108
109 unsigned int odirect;
110 unsigned int oatomic;
111 unsigned int invalidate_cache;
112 unsigned int create_serialize;
113 unsigned int create_fsync;
114 unsigned int create_on_open;
115 unsigned int create_only;
116 unsigned int end_fsync;
117 unsigned int pre_read;
118 unsigned int sync_io;
119 unsigned int write_hint;
120 unsigned int verify;
121 unsigned int do_verify;
122 unsigned int verify_interval;
123 unsigned int verify_offset;
124 char verify_pattern[MAX_PATTERN_SIZE];
125 unsigned int verify_pattern_bytes;
126 struct pattern_fmt verify_fmt[8];
127 unsigned int verify_fmt_sz;
128 unsigned int verify_fatal;
129 unsigned int verify_dump;
130 unsigned int verify_async;
131 unsigned long long verify_backlog;
132 unsigned int verify_batch;
133 unsigned int experimental_verify;
134 unsigned int verify_state;
135 unsigned int verify_state_save;
136 unsigned int use_thread;
137 unsigned int unlink;
138 unsigned int unlink_each_loop;
139 unsigned int do_disk_util;
140 unsigned int override_sync;
141 unsigned int rand_repeatable;
142 unsigned int allrand_repeatable;
143 unsigned long long rand_seed;
144 unsigned int log_avg_msec;
145 unsigned int log_hist_msec;
146 unsigned int log_hist_coarseness;
147 unsigned int log_max;
148 unsigned int log_offset;
149 unsigned int log_gz;
150 unsigned int log_gz_store;
151 unsigned int log_unix_epoch;
152 unsigned int norandommap;
153 unsigned int softrandommap;
154 unsigned int bs_unaligned;
155 unsigned int fsync_on_close;
156 unsigned int bs_is_seq_rand;
157
158 unsigned int verify_only;
159
160 unsigned int random_distribution;
161 unsigned int exitall_error;
162
163 struct zone_split *zone_split[DDIR_RWDIR_CNT];
164 unsigned int zone_split_nr[DDIR_RWDIR_CNT];
165
166 fio_fp64_t zipf_theta;
167 fio_fp64_t pareto_h;
168 fio_fp64_t gauss_dev;
169
170 unsigned int random_generator;
171
172 unsigned int perc_rand[DDIR_RWDIR_CNT];
173
174 unsigned int hugepage_size;
175 unsigned long long rw_min_bs;
176 unsigned int thinktime;
177 unsigned int thinktime_spin;
178 unsigned int thinktime_blocks;
179 unsigned int fsync_blocks;
180 unsigned int fdatasync_blocks;
181 unsigned int barrier_blocks;
182 unsigned long long start_delay;
183 unsigned long long start_delay_orig;
184 unsigned long long start_delay_high;
185 unsigned long long timeout;
186 unsigned long long ramp_time;
187 unsigned int ss_state;
188 fio_fp64_t ss_limit;
189 unsigned long long ss_dur;
190 unsigned long long ss_ramp_time;
191 unsigned int overwrite;
192 unsigned int bw_avg_time;
193 unsigned int iops_avg_time;
194 unsigned int loops;
195 unsigned long long zone_range;
196 unsigned long long zone_size;
197 unsigned long long zone_capacity;
198 unsigned long long zone_skip;
199 enum fio_zone_mode zone_mode;
200 unsigned long long lockmem;
201 enum fio_memtype mem_type;
202 unsigned int mem_align;
203
204 unsigned long long max_latency;
205
206 unsigned int exit_what;
207 unsigned int stonewall;
208 unsigned int new_group;
209 unsigned int numjobs;
210 os_cpu_mask_t cpumask;
211 os_cpu_mask_t verify_cpumask;
212 os_cpu_mask_t log_gz_cpumask;
213 unsigned int cpus_allowed_policy;
214 char *numa_cpunodes;
215 unsigned short numa_mem_mode;
216 unsigned int numa_mem_prefer_node;
217 char *numa_memnodes;
218 unsigned int gpu_dev_id;
219 unsigned int start_offset_percent;
220
221 unsigned int iolog;
222 unsigned int rwmixcycle;
223 unsigned int rwmix[DDIR_RWDIR_CNT];
224 unsigned int nice;
225 unsigned int ioprio;
226 unsigned int ioprio_class;
227 unsigned int file_service_type;
228 unsigned int group_reporting;
229 unsigned int stats;
230 unsigned int fadvise_hint;
231 enum fio_fallocate_mode fallocate_mode;
232 unsigned int zero_buffers;
233 unsigned int refill_buffers;
234 unsigned int scramble_buffers;
235 char buffer_pattern[MAX_PATTERN_SIZE];
236 unsigned int buffer_pattern_bytes;
237 unsigned int compress_percentage;
238 unsigned int compress_chunk;
239 unsigned int dedupe_percentage;
240 unsigned int time_based;
241 unsigned int disable_lat;
242 unsigned int disable_clat;
243 unsigned int disable_slat;
244 unsigned int disable_bw;
245 unsigned int unified_rw_rep;
246 unsigned int gtod_reduce;
247 unsigned int gtod_cpu;
248 enum fio_cs clocksource;
249 unsigned int no_stall;
250 unsigned int trim_percentage;
251 unsigned int trim_batch;
252 unsigned int trim_zero;
253 unsigned long long trim_backlog;
254 unsigned int clat_percentiles;
255 unsigned int slat_percentiles;
256 unsigned int lat_percentiles;
257 unsigned int percentile_precision; /* digits after decimal for percentiles */
258 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
259
260 char *read_iolog_file;
261 bool read_iolog_chunked;
262 char *write_iolog_file;
263 char *merge_blktrace_file;
264 fio_fp64_t merge_blktrace_scalars[FIO_IO_U_LIST_MAX_LEN];
265 fio_fp64_t merge_blktrace_iters[FIO_IO_U_LIST_MAX_LEN];
266
267 unsigned int write_bw_log;
268 unsigned int write_lat_log;
269 unsigned int write_iops_log;
270 unsigned int write_hist_log;
271
272 char *bw_log_file;
273 char *lat_log_file;
274 char *iops_log_file;
275 char *hist_log_file;
276 char *replay_redirect;
277
278 /*
279 * Pre-run and post-run shell
280 */
281 char *exec_prerun;
282 char *exec_postrun;
283
284 uint64_t rate[DDIR_RWDIR_CNT];
285 uint64_t ratemin[DDIR_RWDIR_CNT];
286 unsigned int ratecycle;
287 unsigned int io_submit_mode;
288 unsigned int rate_iops[DDIR_RWDIR_CNT];
289 unsigned int rate_iops_min[DDIR_RWDIR_CNT];
290 unsigned int rate_process;
291 unsigned int rate_ign_think;
292
293 char *ioscheduler;
294
295 /*
296 * I/O Error handling
297 */
298 enum error_type continue_on_error;
299
300 /*
301 * Benchmark profile type
302 */
303 char *profile;
304
305 /*
306 * blkio cgroup support
307 */
308 char *cgroup;
309 unsigned int cgroup_weight;
310 unsigned int cgroup_nodelete;
311
312 unsigned int uid;
313 unsigned int gid;
314
315 unsigned int offset_increment_percent;
316 unsigned long long offset_increment;
317 unsigned long long number_ios;
318
319 unsigned int sync_file_range;
320
321 unsigned long long latency_target;
322 unsigned long long latency_window;
323 fio_fp64_t latency_percentile;
324 uint32_t latency_run;
325
326 /*
327 * flow support
328 */
329 int flow_id;
330 unsigned int flow;
331 unsigned int flow_sleep;
332
333 unsigned int sig_figs;
334
335 unsigned block_error_hist;
336
337 unsigned int replay_align;
338 unsigned int replay_scale;
339 unsigned int replay_time_scale;
340 unsigned int replay_skip;
341
342 unsigned int per_job_logs;
343
344 unsigned int allow_create;
345 unsigned int allow_mounted_write;
346
347 /* Parameters that affect zonemode=zbd */
348 unsigned int read_beyond_wp;
349 int max_open_zones;
350 unsigned int job_max_open_zones;
351 fio_fp64_t zrt;
352 fio_fp64_t zrf;
353};
354
355#define FIO_TOP_STR_MAX 256
356
357struct thread_options_pack {
358 uint64_t set_options[NR_OPTS_SZ];
359 uint8_t description[FIO_TOP_STR_MAX];
360 uint8_t name[FIO_TOP_STR_MAX];
361 uint8_t wait_for[FIO_TOP_STR_MAX];
362 uint8_t directory[FIO_TOP_STR_MAX];
363 uint8_t filename[FIO_TOP_STR_MAX];
364 uint8_t filename_format[FIO_TOP_STR_MAX];
365 uint8_t opendir[FIO_TOP_STR_MAX];
366 uint8_t ioengine[FIO_TOP_STR_MAX];
367 uint8_t mmapfile[FIO_TOP_STR_MAX];
368 uint32_t td_ddir;
369 uint32_t rw_seq;
370 uint32_t kb_base;
371 uint32_t unit_base;
372 uint32_t ddir_seq_nr;
373 uint64_t ddir_seq_add;
374 uint32_t iodepth;
375 uint32_t iodepth_low;
376 uint32_t iodepth_batch;
377 uint32_t iodepth_batch_complete_min;
378 uint32_t iodepth_batch_complete_max;
379 uint32_t serialize_overlap;
380 uint32_t pad;
381
382 uint64_t size;
383 uint64_t io_size;
384 uint32_t size_percent;
385 uint32_t io_size_percent;
386 uint32_t fill_device;
387 uint32_t file_append;
388 uint32_t unique_filename;
389 uint64_t file_size_low;
390 uint64_t file_size_high;
391 uint64_t start_offset;
392 uint64_t start_offset_align;
393
394 uint64_t bs[DDIR_RWDIR_CNT];
395 uint64_t ba[DDIR_RWDIR_CNT];
396 uint64_t min_bs[DDIR_RWDIR_CNT];
397 uint64_t max_bs[DDIR_RWDIR_CNT];
398 struct bssplit bssplit[DDIR_RWDIR_CNT][BSSPLIT_MAX];
399 uint32_t bssplit_nr[DDIR_RWDIR_CNT];
400
401 uint32_t ignore_error[ERROR_TYPE_CNT][ERROR_STR_MAX];
402 uint32_t ignore_error_nr[ERROR_TYPE_CNT];
403 uint32_t error_dump;
404
405 uint32_t nr_files;
406 uint32_t open_files;
407 uint32_t file_lock_mode;
408
409 uint32_t odirect;
410 uint32_t oatomic;
411 uint32_t invalidate_cache;
412 uint32_t create_serialize;
413 uint32_t create_fsync;
414 uint32_t create_on_open;
415 uint32_t create_only;
416 uint32_t end_fsync;
417 uint32_t pre_read;
418 uint32_t sync_io;
419 uint32_t write_hint;
420 uint32_t verify;
421 uint32_t do_verify;
422 uint32_t verify_interval;
423 uint32_t verify_offset;
424 uint8_t verify_pattern[MAX_PATTERN_SIZE];
425 uint32_t verify_pattern_bytes;
426 uint32_t verify_fatal;
427 uint32_t verify_dump;
428 uint32_t verify_async;
429 uint64_t verify_backlog;
430 uint32_t verify_batch;
431 uint32_t experimental_verify;
432 uint32_t verify_state;
433 uint32_t verify_state_save;
434 uint32_t use_thread;
435 uint32_t unlink;
436 uint32_t unlink_each_loop;
437 uint32_t do_disk_util;
438 uint32_t override_sync;
439 uint32_t rand_repeatable;
440 uint32_t allrand_repeatable;
441 uint32_t pad2;
442 uint64_t rand_seed;
443 uint32_t log_avg_msec;
444 uint32_t log_hist_msec;
445 uint32_t log_hist_coarseness;
446 uint32_t log_max;
447 uint32_t log_offset;
448 uint32_t log_gz;
449 uint32_t log_gz_store;
450 uint32_t log_unix_epoch;
451 uint32_t norandommap;
452 uint32_t softrandommap;
453 uint32_t bs_unaligned;
454 uint32_t fsync_on_close;
455 uint32_t bs_is_seq_rand;
456
457 uint32_t random_distribution;
458 uint32_t exitall_error;
459
460 uint32_t sync_file_range;
461
462 struct zone_split zone_split[DDIR_RWDIR_CNT][ZONESPLIT_MAX];
463 uint32_t zone_split_nr[DDIR_RWDIR_CNT];
464
465 uint8_t pad1[4];
466
467 fio_fp64_t zipf_theta;
468 fio_fp64_t pareto_h;
469 fio_fp64_t gauss_dev;
470
471 uint32_t random_generator;
472
473 uint32_t perc_rand[DDIR_RWDIR_CNT];
474
475 uint32_t hugepage_size;
476 uint64_t rw_min_bs;
477 uint32_t thinktime;
478 uint32_t thinktime_spin;
479 uint32_t thinktime_blocks;
480 uint32_t fsync_blocks;
481 uint32_t fdatasync_blocks;
482 uint32_t barrier_blocks;
483 uint64_t start_delay;
484 uint64_t start_delay_high;
485 uint64_t timeout;
486 uint64_t ramp_time;
487 uint64_t ss_dur;
488 uint64_t ss_ramp_time;
489 uint32_t ss_state;
490 fio_fp64_t ss_limit;
491 uint32_t overwrite;
492 uint32_t bw_avg_time;
493 uint32_t iops_avg_time;
494 uint32_t loops;
495 uint64_t zone_range;
496 uint64_t zone_size;
497 uint64_t zone_capacity;
498 uint64_t zone_skip;
499 uint64_t lockmem;
500 uint32_t mem_type;
501 uint32_t mem_align;
502
503 uint32_t exit_what;
504 uint32_t stonewall;
505 uint32_t new_group;
506 uint32_t numjobs;
507 /*
508 * We currently can't convert these, so don't enable them
509 */
510#if 0
511 uint8_t cpumask[FIO_TOP_STR_MAX];
512 uint8_t verify_cpumask[FIO_TOP_STR_MAX];
513 uint8_t log_gz_cpumask[FIO_TOP_STR_MAX];
514#endif
515 uint32_t gpu_dev_id;
516 uint32_t start_offset_percent;
517 uint32_t cpus_allowed_policy;
518 uint32_t iolog;
519 uint32_t rwmixcycle;
520 uint32_t rwmix[DDIR_RWDIR_CNT];
521 uint32_t nice;
522 uint32_t ioprio;
523 uint32_t ioprio_class;
524 uint32_t file_service_type;
525 uint32_t group_reporting;
526 uint32_t stats;
527 uint32_t fadvise_hint;
528 uint32_t fallocate_mode;
529 uint32_t zero_buffers;
530 uint32_t refill_buffers;
531 uint32_t scramble_buffers;
532 uint8_t buffer_pattern[MAX_PATTERN_SIZE];
533 uint32_t buffer_pattern_bytes;
534 uint32_t compress_percentage;
535 uint32_t compress_chunk;
536 uint32_t dedupe_percentage;
537 uint32_t time_based;
538 uint32_t disable_lat;
539 uint32_t disable_clat;
540 uint32_t disable_slat;
541 uint32_t disable_bw;
542 uint32_t unified_rw_rep;
543 uint32_t gtod_reduce;
544 uint32_t gtod_cpu;
545 uint32_t clocksource;
546 uint32_t no_stall;
547 uint32_t trim_percentage;
548 uint32_t trim_batch;
549 uint32_t trim_zero;
550 uint64_t trim_backlog;
551 uint32_t clat_percentiles;
552 uint32_t lat_percentiles;
553 uint32_t slat_percentiles;
554 uint32_t percentile_precision;
555 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
556
557 uint8_t read_iolog_file[FIO_TOP_STR_MAX];
558 uint8_t write_iolog_file[FIO_TOP_STR_MAX];
559 uint8_t merge_blktrace_file[FIO_TOP_STR_MAX];
560 fio_fp64_t merge_blktrace_scalars[FIO_IO_U_LIST_MAX_LEN];
561 fio_fp64_t merge_blktrace_iters[FIO_IO_U_LIST_MAX_LEN];
562
563 uint32_t write_bw_log;
564 uint32_t write_lat_log;
565 uint32_t write_iops_log;
566 uint32_t write_hist_log;
567
568 uint8_t bw_log_file[FIO_TOP_STR_MAX];
569 uint8_t lat_log_file[FIO_TOP_STR_MAX];
570 uint8_t iops_log_file[FIO_TOP_STR_MAX];
571 uint8_t hist_log_file[FIO_TOP_STR_MAX];
572 uint8_t replay_redirect[FIO_TOP_STR_MAX];
573
574 /*
575 * Pre-run and post-run shell
576 */
577 uint8_t exec_prerun[FIO_TOP_STR_MAX];
578 uint8_t exec_postrun[FIO_TOP_STR_MAX];
579
580 uint64_t rate[DDIR_RWDIR_CNT];
581 uint64_t ratemin[DDIR_RWDIR_CNT];
582 uint32_t ratecycle;
583 uint32_t io_submit_mode;
584 uint32_t rate_iops[DDIR_RWDIR_CNT];
585 uint32_t rate_iops_min[DDIR_RWDIR_CNT];
586 uint32_t rate_process;
587 uint32_t rate_ign_think;
588
589 uint8_t ioscheduler[FIO_TOP_STR_MAX];
590
591 /*
592 * I/O Error handling
593 */
594 uint32_t continue_on_error;
595
596 /*
597 * Benchmark profile type
598 */
599 uint8_t profile[FIO_TOP_STR_MAX];
600
601 /*
602 * blkio cgroup support
603 */
604 uint8_t cgroup[FIO_TOP_STR_MAX];
605 uint32_t cgroup_weight;
606 uint32_t cgroup_nodelete;
607
608 uint32_t uid;
609 uint32_t gid;
610
611 uint32_t offset_increment_percent;
612 uint64_t offset_increment;
613 uint64_t number_ios;
614
615 uint64_t latency_target;
616 uint64_t latency_window;
617 uint64_t max_latency;
618 fio_fp64_t latency_percentile;
619 uint32_t latency_run;
620
621 /*
622 * flow support
623 */
624 int32_t flow_id;
625 uint32_t flow;
626 uint32_t flow_sleep;
627
628 uint32_t sig_figs;
629
630 uint32_t block_error_hist;
631
632 uint32_t replay_align;
633 uint32_t replay_scale;
634 uint32_t replay_time_scale;
635 uint32_t replay_skip;
636
637 uint32_t per_job_logs;
638
639 uint32_t allow_create;
640 uint32_t allow_mounted_write;
641
642 uint32_t zone_mode;
643} __attribute__((packed));
644
645extern void convert_thread_options_to_cpu(struct thread_options *o, struct thread_options_pack *top);
646extern void convert_thread_options_to_net(struct thread_options_pack *top, struct thread_options *);
647extern int fio_test_cconv(struct thread_options *);
648extern void options_default_fill(struct thread_options *o);
649
650#endif