Fix min/max typeof warnings
[fio.git] / thread_options.h
CommitLineData
8062f527
JA
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 "stat.h"
7#include "gettime.h"
888677a4 8#include "lib/ieee754.h"
3c978125 9#include "td_error.h"
8062f527
JA
10
11/*
12 * What type of allocation to use for io buffers
13 */
14enum fio_memtype {
15 MEM_MALLOC = 0, /* ordinary malloc */
16 MEM_SHM, /* use shared memory segments */
17 MEM_SHMHUGE, /* use shared memory segments with huge pages */
18 MEM_MMAP, /* use anonynomous mmap */
19 MEM_MMAPHUGE, /* memory mapped huge file */
20};
21
8062f527
JA
22#define ERROR_STR_MAX 128
23
8062f527
JA
24#define BSSPLIT_MAX 64
25
26struct bssplit {
27 uint32_t bs;
28 uint32_t perc;
29};
30
cb1402d6
JA
31#define OPT_MAGIC 0x4f50544e
32
8062f527 33struct thread_options {
cb1402d6 34 int magic;
8062f527
JA
35 char *description;
36 char *name;
37 char *directory;
38 char *filename;
39 char *filename_format;
40 char *opendir;
41 char *ioengine;
83ea422a 42 char *mmapfile;
8062f527
JA
43 enum td_ddir td_ddir;
44 unsigned int rw_seq;
45 unsigned int kb_base;
46 unsigned int unit_base;
47 unsigned int ddir_seq_nr;
c46fda90 48 long long ddir_seq_add;
8062f527
JA
49 unsigned int iodepth;
50 unsigned int iodepth_low;
51 unsigned int iodepth_batch;
52 unsigned int iodepth_batch_complete;
53
54 unsigned long long size;
77731b29 55 unsigned long long io_limit;
8062f527
JA
56 unsigned int size_percent;
57 unsigned int fill_device;
bedc9dc2 58 unsigned int file_append;
8062f527
JA
59 unsigned long long file_size_low;
60 unsigned long long file_size_high;
61 unsigned long long start_offset;
62
63 unsigned int bs[DDIR_RWDIR_CNT];
64 unsigned int ba[DDIR_RWDIR_CNT];
65 unsigned int min_bs[DDIR_RWDIR_CNT];
66 unsigned int max_bs[DDIR_RWDIR_CNT];
67 struct bssplit *bssplit[DDIR_RWDIR_CNT];
68 unsigned int bssplit_nr[DDIR_RWDIR_CNT];
69
70 int *ignore_error[ERROR_TYPE_CNT];
71 unsigned int ignore_error_nr[ERROR_TYPE_CNT];
72 unsigned int error_dump;
73
74 unsigned int nr_files;
75 unsigned int open_files;
76 enum file_lock_mode file_lock_mode;
77
78 unsigned int odirect;
d01612f3 79 unsigned int oatomic;
8062f527
JA
80 unsigned int invalidate_cache;
81 unsigned int create_serialize;
82 unsigned int create_fsync;
83 unsigned int create_on_open;
84 unsigned int create_only;
85 unsigned int end_fsync;
86 unsigned int pre_read;
87 unsigned int sync_io;
88 unsigned int verify;
89 unsigned int do_verify;
90 unsigned int verifysort;
91 unsigned int verifysort_nr;
92 unsigned int verify_interval;
93 unsigned int verify_offset;
94 char verify_pattern[MAX_PATTERN_SIZE];
95 unsigned int verify_pattern_bytes;
96 unsigned int verify_fatal;
97 unsigned int verify_dump;
98 unsigned int verify_async;
99 unsigned long long verify_backlog;
100 unsigned int verify_batch;
101 unsigned int experimental_verify;
102 unsigned int use_thread;
103 unsigned int unlink;
104 unsigned int do_disk_util;
105 unsigned int override_sync;
106 unsigned int rand_repeatable;
56e2a5fc 107 unsigned int allrand_repeatable;
363cffa7 108 unsigned long long rand_seed;
8062f527 109 unsigned int use_os_rand;
8062f527 110 unsigned int log_avg_msec;
ae588852 111 unsigned int log_offset;
aee2ab67 112 unsigned int log_gz;
b26317c9 113 unsigned int log_gz_store;
8062f527
JA
114 unsigned int norandommap;
115 unsigned int softrandommap;
116 unsigned int bs_unaligned;
117 unsigned int fsync_on_close;
6aca9b3d 118 unsigned int bs_is_seq_rand;
8062f527 119
62167762
JC
120 unsigned int verify_only;
121
8062f527 122 unsigned int random_distribution;
b7f487cf 123
888677a4
JA
124 fio_fp64_t zipf_theta;
125 fio_fp64_t pareto_h;
8062f527
JA
126
127 unsigned int random_generator;
128
d9472271 129 unsigned int perc_rand[DDIR_RWDIR_CNT];
211c9b89 130
8062f527
JA
131 unsigned int hugepage_size;
132 unsigned int rw_min_bs;
133 unsigned int thinktime;
134 unsigned int thinktime_spin;
135 unsigned int thinktime_blocks;
136 unsigned int fsync_blocks;
137 unsigned int fdatasync_blocks;
138 unsigned int barrier_blocks;
139 unsigned long long start_delay;
23ed19b0 140 unsigned long long start_delay_high;
8062f527
JA
141 unsigned long long timeout;
142 unsigned long long ramp_time;
143 unsigned int overwrite;
144 unsigned int bw_avg_time;
145 unsigned int iops_avg_time;
146 unsigned int loops;
147 unsigned long long zone_range;
148 unsigned long long zone_size;
149 unsigned long long zone_skip;
81c6b6cd 150 unsigned long long lockmem;
8062f527
JA
151 enum fio_memtype mem_type;
152 unsigned int mem_align;
153
154 unsigned int max_latency;
155
156 unsigned int stonewall;
157 unsigned int new_group;
158 unsigned int numjobs;
159 os_cpu_mask_t cpumask;
160 unsigned int cpumask_set;
161 os_cpu_mask_t verify_cpumask;
162 unsigned int verify_cpumask_set;
c2acfbac 163 unsigned int cpus_allowed_policy;
43522848 164 char *numa_cpunodes;
8062f527
JA
165 unsigned int numa_cpumask_set;
166 unsigned short numa_mem_mode;
167 unsigned int numa_mem_prefer_node;
43522848 168 char *numa_memnodes;
8062f527 169 unsigned int numa_memmask_set;
8062f527
JA
170 unsigned int iolog;
171 unsigned int rwmixcycle;
5054e67c 172 unsigned int rwmix[DDIR_RWDIR_CNT];
8062f527 173 unsigned int nice;
81c6b6cd
JA
174 unsigned int ioprio;
175 unsigned int ioprio_class;
8062f527
JA
176 unsigned int file_service_type;
177 unsigned int group_reporting;
178 unsigned int fadvise_hint;
179 enum fio_fallocate_mode fallocate_mode;
180 unsigned int zero_buffers;
181 unsigned int refill_buffers;
182 unsigned int scramble_buffers;
ce35b1ec
JA
183 char buffer_pattern[MAX_PATTERN_SIZE];
184 unsigned int buffer_pattern_bytes;
8062f527
JA
185 unsigned int compress_percentage;
186 unsigned int compress_chunk;
5c94b008 187 unsigned int dedupe_percentage;
8062f527
JA
188 unsigned int time_based;
189 unsigned int disable_lat;
190 unsigned int disable_clat;
191 unsigned int disable_slat;
192 unsigned int disable_bw;
193 unsigned int unified_rw_rep;
194 unsigned int gtod_reduce;
195 unsigned int gtod_cpu;
196 unsigned int gtod_offload;
197 enum fio_cs clocksource;
198 unsigned int no_stall;
199 unsigned int trim_percentage;
200 unsigned int trim_batch;
201 unsigned int trim_zero;
202 unsigned long long trim_backlog;
203 unsigned int clat_percentiles;
204 unsigned int percentile_precision; /* digits after decimal for percentiles */
205 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
206
207 char *read_iolog_file;
208 char *write_iolog_file;
209 char *bw_log_file;
210 char *lat_log_file;
211 char *iops_log_file;
212 char *replay_redirect;
213
214 /*
215 * Pre-run and post-run shell
216 */
217 char *exec_prerun;
218 char *exec_postrun;
219
220 unsigned int rate[DDIR_RWDIR_CNT];
221 unsigned int ratemin[DDIR_RWDIR_CNT];
222 unsigned int ratecycle;
223 unsigned int rate_iops[DDIR_RWDIR_CNT];
224 unsigned int rate_iops_min[DDIR_RWDIR_CNT];
225
226 char *ioscheduler;
227
8062f527
JA
228 /*
229 * I/O Error handling
230 */
231 enum error_type continue_on_error;
232
233 /*
234 * Benchmark profile type
235 */
236 char *profile;
237
238 /*
239 * blkio cgroup support
240 */
241 char *cgroup;
242 unsigned int cgroup_weight;
243 unsigned int cgroup_nodelete;
244
245 unsigned int uid;
246 unsigned int gid;
247
248 int flow_id;
249 int flow;
250 int flow_watermark;
251 unsigned int flow_sleep;
252
253 unsigned long long offset_increment;
ddf24e42 254 unsigned long long number_ios;
8062f527
JA
255
256 unsigned int sync_file_range;
3e260a46
JA
257
258 unsigned long long latency_target;
259 unsigned long long latency_window;
260 fio_fp64_t latency_percentile;
8062f527
JA
261};
262
2dc1cbb5
JA
263#define FIO_TOP_STR_MAX 256
264
265struct thread_options_pack {
266 uint8_t description[FIO_TOP_STR_MAX];
267 uint8_t name[FIO_TOP_STR_MAX];
268 uint8_t directory[FIO_TOP_STR_MAX];
269 uint8_t filename[FIO_TOP_STR_MAX];
22f80458 270 uint8_t filename_format[FIO_TOP_STR_MAX];
2dc1cbb5
JA
271 uint8_t opendir[FIO_TOP_STR_MAX];
272 uint8_t ioengine[FIO_TOP_STR_MAX];
83ea422a 273 uint8_t mmapfile[FIO_TOP_STR_MAX];
2dc1cbb5
JA
274 uint32_t td_ddir;
275 uint32_t rw_seq;
276 uint32_t kb_base;
22f80458 277 uint32_t unit_base;
2dc1cbb5
JA
278 uint32_t ddir_seq_nr;
279 uint64_t ddir_seq_add;
280 uint32_t iodepth;
281 uint32_t iodepth_low;
282 uint32_t iodepth_batch;
283 uint32_t iodepth_batch_complete;
284
285 uint64_t size;
77731b29 286 uint64_t io_limit;
2dc1cbb5
JA
287 uint32_t size_percent;
288 uint32_t fill_device;
bedc9dc2 289 uint32_t file_append;
2dc1cbb5
JA
290 uint64_t file_size_low;
291 uint64_t file_size_high;
292 uint64_t start_offset;
293
b999b3c7
JA
294 uint32_t bs[DDIR_RWDIR_CNT];
295 uint32_t ba[DDIR_RWDIR_CNT];
296 uint32_t min_bs[DDIR_RWDIR_CNT];
297 uint32_t max_bs[DDIR_RWDIR_CNT];
298 struct bssplit bssplit[DDIR_RWDIR_CNT][BSSPLIT_MAX];
299 uint32_t bssplit_nr[DDIR_RWDIR_CNT];
2dc1cbb5 300
e65a950a
JA
301 uint32_t ignore_error[ERROR_TYPE_CNT][ERROR_STR_MAX];
302 uint32_t ignore_error_nr[ERROR_TYPE_CNT];
303 uint32_t error_dump;
304
2dc1cbb5
JA
305 uint32_t nr_files;
306 uint32_t open_files;
307 uint32_t file_lock_mode;
2dc1cbb5
JA
308
309 uint32_t odirect;
d01612f3 310 uint32_t oatomic;
2dc1cbb5
JA
311 uint32_t invalidate_cache;
312 uint32_t create_serialize;
313 uint32_t create_fsync;
314 uint32_t create_on_open;
fb390e24 315 uint32_t create_only;
2dc1cbb5
JA
316 uint32_t end_fsync;
317 uint32_t pre_read;
318 uint32_t sync_io;
319 uint32_t verify;
320 uint32_t do_verify;
321 uint32_t verifysort;
836fcc0f 322 uint32_t verifysort_nr;
2dc1cbb5
JA
323 uint32_t verify_interval;
324 uint32_t verify_offset;
325 uint8_t verify_pattern[MAX_PATTERN_SIZE];
326 uint32_t verify_pattern_bytes;
327 uint32_t verify_fatal;
328 uint32_t verify_dump;
329 uint32_t verify_async;
330 uint64_t verify_backlog;
331 uint32_t verify_batch;
836fcc0f 332 uint32_t experimental_verify;
2dc1cbb5
JA
333 uint32_t use_thread;
334 uint32_t unlink;
335 uint32_t do_disk_util;
336 uint32_t override_sync;
337 uint32_t rand_repeatable;
56e2a5fc 338 uint32_t allrand_repeatable;
363cffa7 339 uint64_t rand_seed;
2dc1cbb5 340 uint32_t use_os_rand;
2dc1cbb5 341 uint32_t log_avg_msec;
ae588852 342 uint32_t log_offset;
aee2ab67 343 uint32_t log_gz;
b26317c9 344 uint32_t log_gz_store;
2dc1cbb5
JA
345 uint32_t norandommap;
346 uint32_t softrandommap;
347 uint32_t bs_unaligned;
348 uint32_t fsync_on_close;
6aca9b3d 349 uint32_t bs_is_seq_rand;
2dc1cbb5 350
1e5324e7
JA
351 uint32_t random_distribution;
352 fio_fp64_t zipf_theta;
353 fio_fp64_t pareto_h;
354
49758e11
JA
355 uint32_t random_generator;
356
d9472271 357 uint32_t perc_rand[DDIR_RWDIR_CNT];
211c9b89 358
2dc1cbb5
JA
359 uint32_t hugepage_size;
360 uint32_t rw_min_bs;
361 uint32_t thinktime;
362 uint32_t thinktime_spin;
363 uint32_t thinktime_blocks;
364 uint32_t fsync_blocks;
365 uint32_t fdatasync_blocks;
366 uint32_t barrier_blocks;
367 uint64_t start_delay;
23ed19b0 368 uint64_t start_delay_high;
2dc1cbb5
JA
369 uint64_t timeout;
370 uint64_t ramp_time;
371 uint32_t overwrite;
372 uint32_t bw_avg_time;
373 uint32_t iops_avg_time;
374 uint32_t loops;
375 uint64_t zone_range;
376 uint64_t zone_size;
377 uint64_t zone_skip;
ae278f9a 378 uint64_t lockmem;
2dc1cbb5
JA
379 uint32_t mem_type;
380 uint32_t mem_align;
381
1e5324e7
JA
382 uint32_t max_latency;
383
2dc1cbb5
JA
384 uint32_t stonewall;
385 uint32_t new_group;
386 uint32_t numjobs;
387 uint8_t cpumask[FIO_TOP_STR_MAX];
388 uint32_t cpumask_set;
389 uint8_t verify_cpumask[FIO_TOP_STR_MAX];
390 uint32_t verify_cpumask_set;
c2acfbac 391 uint32_t cpus_allowed_policy;
2dc1cbb5
JA
392 uint32_t iolog;
393 uint32_t rwmixcycle;
5054e67c 394 uint32_t rwmix[DDIR_RWDIR_CNT];
2dc1cbb5 395 uint32_t nice;
28727df7
JA
396 uint32_t ioprio;
397 uint32_t ioprio_class;
2dc1cbb5
JA
398 uint32_t file_service_type;
399 uint32_t group_reporting;
400 uint32_t fadvise_hint;
401 uint32_t fallocate_mode;
402 uint32_t zero_buffers;
403 uint32_t refill_buffers;
404 uint32_t scramble_buffers;
ce35b1ec
JA
405 uint8_t buffer_pattern[MAX_PATTERN_SIZE];
406 uint32_t buffer_pattern_bytes;
5c94b008
JA
407 uint32_t compress_percentage;
408 uint32_t compress_chunk;
409 uint32_t dedupe_percentage;
2dc1cbb5
JA
410 uint32_t time_based;
411 uint32_t disable_lat;
412 uint32_t disable_clat;
413 uint32_t disable_slat;
414 uint32_t disable_bw;
95820b6e 415 uint32_t unified_rw_rep;
2dc1cbb5
JA
416 uint32_t gtod_reduce;
417 uint32_t gtod_cpu;
418 uint32_t gtod_offload;
419 uint32_t clocksource;
420 uint32_t no_stall;
421 uint32_t trim_percentage;
422 uint32_t trim_batch;
423 uint32_t trim_zero;
424 uint64_t trim_backlog;
425 uint32_t clat_percentiles;
9db01ef9 426 uint32_t percentile_precision;
2dc1cbb5
JA
427 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
428
429 uint8_t read_iolog_file[FIO_TOP_STR_MAX];
430 uint8_t write_iolog_file[FIO_TOP_STR_MAX];
431 uint8_t bw_log_file[FIO_TOP_STR_MAX];
432 uint8_t lat_log_file[FIO_TOP_STR_MAX];
433 uint8_t iops_log_file[FIO_TOP_STR_MAX];
434 uint8_t replay_redirect[FIO_TOP_STR_MAX];
435
436 /*
437 * Pre-run and post-run shell
438 */
439 uint8_t exec_prerun[FIO_TOP_STR_MAX];
440 uint8_t exec_postrun[FIO_TOP_STR_MAX];
441
b999b3c7
JA
442 uint32_t rate[DDIR_RWDIR_CNT];
443 uint32_t ratemin[DDIR_RWDIR_CNT];
2dc1cbb5 444 uint32_t ratecycle;
b999b3c7
JA
445 uint32_t rate_iops[DDIR_RWDIR_CNT];
446 uint32_t rate_iops_min[DDIR_RWDIR_CNT];
2dc1cbb5
JA
447
448 uint8_t ioscheduler[FIO_TOP_STR_MAX];
449
2dc1cbb5
JA
450 /*
451 * I/O Error handling
452 */
453 uint32_t continue_on_error;
454
455 /*
456 * Benchmark profile type
457 */
458 uint8_t profile[FIO_TOP_STR_MAX];
459
460 /*
461 * blkio cgroup support
462 */
463 uint8_t cgroup[FIO_TOP_STR_MAX];
464 uint32_t cgroup_weight;
465 uint32_t cgroup_nodelete;
466
467 uint32_t uid;
468 uint32_t gid;
469
470 int32_t flow_id;
471 int32_t flow;
472 int32_t flow_watermark;
473 uint32_t flow_sleep;
474
6a4cf74f 475 uint64_t offset_increment;
ddf24e42 476 uint64_t number_ios;
6a4cf74f 477
2dc1cbb5 478 uint32_t sync_file_range;
3e260a46
JA
479
480 uint64_t latency_target;
481 uint64_t latency_window;
482 fio_fp64_t latency_percentile;
2dc1cbb5
JA
483} __attribute__((packed));
484
485extern void convert_thread_options_to_cpu(struct thread_options *o, struct thread_options_pack *top);
486extern void convert_thread_options_to_net(struct thread_options_pack *top, struct thread_options *);
51167799 487extern int fio_test_cconv(struct thread_options *);
588b7f09 488extern void options_default_fill(struct thread_options *o);
2dc1cbb5 489
8062f527 490#endif