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