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