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