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