blob: 14a4e54abcc757a68abe701a60c99a03756459fd [file] [log] [blame]
Jens Axboe8062f522013-04-10 15:01:42 +02001#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"
Jens Axboe888677a2013-04-10 22:19:46 +02008#include "lib/ieee754.h"
Jens Axboe3c978122013-04-17 19:27:46 +02009#include "td_error.h"
Jens Axboe8062f522013-04-10 15:01:42 +020010
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
Jens Axboe8062f522013-04-10 15:01:42 +020022#define ERROR_STR_MAX 128
23
Jens Axboe8062f522013-04-10 15:01:42 +020024#define BSSPLIT_MAX 64
25
26struct bssplit {
27 uint32_t bs;
28 uint32_t perc;
29};
30
Jens Axboecb1402d2014-02-25 11:35:27 -080031#define OPT_MAGIC 0x4f50544e
32
Jens Axboe8062f522013-04-10 15:01:42 +020033struct thread_options {
Jens Axboecb1402d2014-02-25 11:35:27 -080034 int magic;
Jens Axboe8062f522013-04-10 15:01:42 +020035 char *description;
36 char *name;
37 char *directory;
38 char *filename;
39 char *filename_format;
40 char *opendir;
41 char *ioengine;
Jens Axboe83ea4222012-03-28 14:01:46 +020042 char *mmapfile;
Jens Axboe8062f522013-04-10 15:01:42 +020043 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;
48 long ddir_seq_add;
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;
55 unsigned int size_percent;
56 unsigned int fill_device;
57 unsigned long long file_size_low;
58 unsigned long long file_size_high;
59 unsigned long long start_offset;
60
61 unsigned int bs[DDIR_RWDIR_CNT];
62 unsigned int ba[DDIR_RWDIR_CNT];
63 unsigned int min_bs[DDIR_RWDIR_CNT];
64 unsigned int max_bs[DDIR_RWDIR_CNT];
65 struct bssplit *bssplit[DDIR_RWDIR_CNT];
66 unsigned int bssplit_nr[DDIR_RWDIR_CNT];
67
68 int *ignore_error[ERROR_TYPE_CNT];
69 unsigned int ignore_error_nr[ERROR_TYPE_CNT];
70 unsigned int error_dump;
71
72 unsigned int nr_files;
73 unsigned int open_files;
74 enum file_lock_mode file_lock_mode;
75
76 unsigned int odirect;
Chris Masond01612f2013-11-15 15:52:58 -070077 unsigned int oatomic;
Jens Axboe8062f522013-04-10 15:01:42 +020078 unsigned int invalidate_cache;
79 unsigned int create_serialize;
80 unsigned int create_fsync;
81 unsigned int create_on_open;
82 unsigned int create_only;
83 unsigned int end_fsync;
84 unsigned int pre_read;
85 unsigned int sync_io;
86 unsigned int verify;
87 unsigned int do_verify;
88 unsigned int verifysort;
89 unsigned int verifysort_nr;
90 unsigned int verify_interval;
91 unsigned int verify_offset;
92 char verify_pattern[MAX_PATTERN_SIZE];
93 unsigned int verify_pattern_bytes;
94 unsigned int verify_fatal;
95 unsigned int verify_dump;
96 unsigned int verify_async;
97 unsigned long long verify_backlog;
98 unsigned int verify_batch;
99 unsigned int experimental_verify;
100 unsigned int use_thread;
101 unsigned int unlink;
102 unsigned int do_disk_util;
103 unsigned int override_sync;
104 unsigned int rand_repeatable;
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -0800105 unsigned int allrand_repeatable;
Grant Grundler363cffa2014-01-28 15:11:23 -0700106 unsigned long long rand_seed;
Jens Axboe8062f522013-04-10 15:01:42 +0200107 unsigned int use_os_rand;
Jens Axboe8062f522013-04-10 15:01:42 +0200108 unsigned int log_avg_msec;
109 unsigned int norandommap;
110 unsigned int softrandommap;
111 unsigned int bs_unaligned;
112 unsigned int fsync_on_close;
Jens Axboe6aca9b32013-07-25 12:45:26 -0600113 unsigned int bs_is_seq_rand;
Jens Axboe8062f522013-04-10 15:01:42 +0200114
Juan Casse62167762013-09-17 14:06:13 -0700115 unsigned int verify_only;
116
Jens Axboe8062f522013-04-10 15:01:42 +0200117 unsigned int random_distribution;
Jens Axboeb7f487c2013-04-10 19:50:32 +0200118
Jens Axboe888677a2013-04-10 22:19:46 +0200119 fio_fp64_t zipf_theta;
120 fio_fp64_t pareto_h;
Jens Axboe8062f522013-04-10 15:01:42 +0200121
122 unsigned int random_generator;
123
Jens Axboed9472272013-07-25 10:20:45 -0600124 unsigned int perc_rand[DDIR_RWDIR_CNT];
Jens Axboe211c9b82013-04-26 08:56:17 -0600125
Jens Axboe8062f522013-04-10 15:01:42 +0200126 unsigned int hugepage_size;
127 unsigned int rw_min_bs;
128 unsigned int thinktime;
129 unsigned int thinktime_spin;
130 unsigned int thinktime_blocks;
131 unsigned int fsync_blocks;
132 unsigned int fdatasync_blocks;
133 unsigned int barrier_blocks;
134 unsigned long long start_delay;
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -0800135 unsigned long long start_delay_high;
Jens Axboe8062f522013-04-10 15:01:42 +0200136 unsigned long long timeout;
137 unsigned long long ramp_time;
138 unsigned int overwrite;
139 unsigned int bw_avg_time;
140 unsigned int iops_avg_time;
141 unsigned int loops;
142 unsigned long long zone_range;
143 unsigned long long zone_size;
144 unsigned long long zone_skip;
Jens Axboe81c6b6c2013-04-10 19:30:50 +0200145 unsigned long long lockmem;
Jens Axboe8062f522013-04-10 15:01:42 +0200146 enum fio_memtype mem_type;
147 unsigned int mem_align;
148
149 unsigned int max_latency;
150
151 unsigned int stonewall;
152 unsigned int new_group;
153 unsigned int numjobs;
154 os_cpu_mask_t cpumask;
155 unsigned int cpumask_set;
156 os_cpu_mask_t verify_cpumask;
157 unsigned int verify_cpumask_set;
158#ifdef CONFIG_LIBNUMA
159 struct bitmask *numa_cpunodesmask;
160 unsigned int numa_cpumask_set;
161 unsigned short numa_mem_mode;
162 unsigned int numa_mem_prefer_node;
163 struct bitmask *numa_memnodesmask;
164 unsigned int numa_memmask_set;
165#endif
166 unsigned int iolog;
167 unsigned int rwmixcycle;
Jens Axboe5054e672013-11-08 10:57:08 -0700168 unsigned int rwmix[DDIR_RWDIR_CNT];
Jens Axboe8062f522013-04-10 15:01:42 +0200169 unsigned int nice;
Jens Axboe81c6b6c2013-04-10 19:30:50 +0200170 unsigned int ioprio;
171 unsigned int ioprio_class;
Jens Axboe8062f522013-04-10 15:01:42 +0200172 unsigned int file_service_type;
173 unsigned int group_reporting;
174 unsigned int fadvise_hint;
175 enum fio_fallocate_mode fallocate_mode;
176 unsigned int zero_buffers;
177 unsigned int refill_buffers;
178 unsigned int scramble_buffers;
Jens Axboece35b1e2014-01-14 15:35:58 -0700179 char buffer_pattern[MAX_PATTERN_SIZE];
180 unsigned int buffer_pattern_bytes;
Jens Axboe8062f522013-04-10 15:01:42 +0200181 unsigned int compress_percentage;
182 unsigned int compress_chunk;
183 unsigned int time_based;
184 unsigned int disable_lat;
185 unsigned int disable_clat;
186 unsigned int disable_slat;
187 unsigned int disable_bw;
188 unsigned int unified_rw_rep;
189 unsigned int gtod_reduce;
190 unsigned int gtod_cpu;
191 unsigned int gtod_offload;
192 enum fio_cs clocksource;
193 unsigned int no_stall;
194 unsigned int trim_percentage;
195 unsigned int trim_batch;
196 unsigned int trim_zero;
197 unsigned long long trim_backlog;
198 unsigned int clat_percentiles;
199 unsigned int percentile_precision; /* digits after decimal for percentiles */
200 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
201
202 char *read_iolog_file;
203 char *write_iolog_file;
204 char *bw_log_file;
205 char *lat_log_file;
206 char *iops_log_file;
207 char *replay_redirect;
208
209 /*
210 * Pre-run and post-run shell
211 */
212 char *exec_prerun;
213 char *exec_postrun;
214
215 unsigned int rate[DDIR_RWDIR_CNT];
216 unsigned int ratemin[DDIR_RWDIR_CNT];
217 unsigned int ratecycle;
218 unsigned int rate_iops[DDIR_RWDIR_CNT];
219 unsigned int rate_iops_min[DDIR_RWDIR_CNT];
220
221 char *ioscheduler;
222
223 /*
Jens Axboe8062f522013-04-10 15:01:42 +0200224 * I/O Error handling
225 */
226 enum error_type continue_on_error;
227
228 /*
229 * Benchmark profile type
230 */
231 char *profile;
232
233 /*
234 * blkio cgroup support
235 */
236 char *cgroup;
237 unsigned int cgroup_weight;
238 unsigned int cgroup_nodelete;
239
240 unsigned int uid;
241 unsigned int gid;
242
243 int flow_id;
244 int flow;
245 int flow_watermark;
246 unsigned int flow_sleep;
247
248 unsigned long long offset_increment;
Jens Axboeddf24e42013-08-09 12:53:44 -0600249 unsigned long long number_ios;
Jens Axboe8062f522013-04-10 15:01:42 +0200250
251 unsigned int sync_file_range;
Jens Axboe3e260a42013-12-09 12:38:53 -0700252
253 unsigned long long latency_target;
254 unsigned long long latency_window;
255 fio_fp64_t latency_percentile;
Jens Axboe8062f522013-04-10 15:01:42 +0200256};
257
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100258#define FIO_TOP_STR_MAX 256
259
260struct thread_options_pack {
261 uint8_t description[FIO_TOP_STR_MAX];
262 uint8_t name[FIO_TOP_STR_MAX];
263 uint8_t directory[FIO_TOP_STR_MAX];
264 uint8_t filename[FIO_TOP_STR_MAX];
Jens Axboe22f80452013-04-09 20:29:16 +0200265 uint8_t filename_format[FIO_TOP_STR_MAX];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100266 uint8_t opendir[FIO_TOP_STR_MAX];
267 uint8_t ioengine[FIO_TOP_STR_MAX];
Jens Axboe83ea4222012-03-28 14:01:46 +0200268 uint8_t mmapfile[FIO_TOP_STR_MAX];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100269 uint32_t td_ddir;
270 uint32_t rw_seq;
271 uint32_t kb_base;
Jens Axboe22f80452013-04-09 20:29:16 +0200272 uint32_t unit_base;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100273 uint32_t ddir_seq_nr;
274 uint64_t ddir_seq_add;
275 uint32_t iodepth;
276 uint32_t iodepth_low;
277 uint32_t iodepth_batch;
278 uint32_t iodepth_batch_complete;
279
280 uint64_t size;
281 uint32_t size_percent;
282 uint32_t fill_device;
283 uint64_t file_size_low;
284 uint64_t file_size_high;
285 uint64_t start_offset;
286
Jens Axboeb999b3c2012-09-24 09:39:49 +0200287 uint32_t bs[DDIR_RWDIR_CNT];
288 uint32_t ba[DDIR_RWDIR_CNT];
289 uint32_t min_bs[DDIR_RWDIR_CNT];
290 uint32_t max_bs[DDIR_RWDIR_CNT];
291 struct bssplit bssplit[DDIR_RWDIR_CNT][BSSPLIT_MAX];
292 uint32_t bssplit_nr[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100293
Jens Axboee65a9502012-09-24 09:24:04 +0200294 uint32_t ignore_error[ERROR_TYPE_CNT][ERROR_STR_MAX];
295 uint32_t ignore_error_nr[ERROR_TYPE_CNT];
296 uint32_t error_dump;
297
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100298 uint32_t nr_files;
299 uint32_t open_files;
300 uint32_t file_lock_mode;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100301
302 uint32_t odirect;
Chris Masond01612f2013-11-15 15:52:58 -0700303 uint32_t oatomic;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100304 uint32_t invalidate_cache;
305 uint32_t create_serialize;
306 uint32_t create_fsync;
307 uint32_t create_on_open;
Jens Axboefb390e22012-05-07 09:54:41 +0200308 uint32_t create_only;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100309 uint32_t end_fsync;
310 uint32_t pre_read;
311 uint32_t sync_io;
312 uint32_t verify;
313 uint32_t do_verify;
314 uint32_t verifysort;
Jens Axboe836fcc02013-01-24 09:08:45 -0700315 uint32_t verifysort_nr;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100316 uint32_t verify_interval;
317 uint32_t verify_offset;
318 uint8_t verify_pattern[MAX_PATTERN_SIZE];
319 uint32_t verify_pattern_bytes;
320 uint32_t verify_fatal;
321 uint32_t verify_dump;
322 uint32_t verify_async;
323 uint64_t verify_backlog;
324 uint32_t verify_batch;
Jens Axboe836fcc02013-01-24 09:08:45 -0700325 uint32_t experimental_verify;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100326 uint32_t use_thread;
327 uint32_t unlink;
328 uint32_t do_disk_util;
329 uint32_t override_sync;
330 uint32_t rand_repeatable;
Christian Ehrhardt56e2a5f2014-02-20 09:10:17 -0800331 uint32_t allrand_repeatable;
Grant Grundler363cffa2014-01-28 15:11:23 -0700332 uint64_t rand_seed;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100333 uint32_t use_os_rand;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100334 uint32_t log_avg_msec;
335 uint32_t norandommap;
336 uint32_t softrandommap;
337 uint32_t bs_unaligned;
338 uint32_t fsync_on_close;
Jens Axboe6aca9b32013-07-25 12:45:26 -0600339 uint32_t bs_is_seq_rand;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100340
Jens Axboe1e5324e2012-11-14 14:25:31 -0700341 uint32_t random_distribution;
342 fio_fp64_t zipf_theta;
343 fio_fp64_t pareto_h;
344
Jens Axboe49758e12012-12-03 14:37:23 +0100345 uint32_t random_generator;
346
Jens Axboed9472272013-07-25 10:20:45 -0600347 uint32_t perc_rand[DDIR_RWDIR_CNT];
Jens Axboe211c9b82013-04-26 08:56:17 -0600348
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100349 uint32_t hugepage_size;
350 uint32_t rw_min_bs;
351 uint32_t thinktime;
352 uint32_t thinktime_spin;
353 uint32_t thinktime_blocks;
354 uint32_t fsync_blocks;
355 uint32_t fdatasync_blocks;
356 uint32_t barrier_blocks;
357 uint64_t start_delay;
Christian Ehrhardt23ed19b2014-02-20 09:07:02 -0800358 uint64_t start_delay_high;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100359 uint64_t timeout;
360 uint64_t ramp_time;
361 uint32_t overwrite;
362 uint32_t bw_avg_time;
363 uint32_t iops_avg_time;
364 uint32_t loops;
365 uint64_t zone_range;
366 uint64_t zone_size;
367 uint64_t zone_skip;
Jens Axboeae278f92012-03-28 20:52:55 +0200368 uint64_t lockmem;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100369 uint32_t mem_type;
370 uint32_t mem_align;
371
Jens Axboe1e5324e2012-11-14 14:25:31 -0700372 uint32_t max_latency;
373
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100374 uint32_t stonewall;
375 uint32_t new_group;
376 uint32_t numjobs;
377 uint8_t cpumask[FIO_TOP_STR_MAX];
378 uint32_t cpumask_set;
379 uint8_t verify_cpumask[FIO_TOP_STR_MAX];
380 uint32_t verify_cpumask_set;
381 uint32_t iolog;
382 uint32_t rwmixcycle;
Jens Axboe5054e672013-11-08 10:57:08 -0700383 uint32_t rwmix[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100384 uint32_t nice;
Jens Axboe28727df2012-03-29 08:33:15 +0200385 uint32_t ioprio;
386 uint32_t ioprio_class;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100387 uint32_t file_service_type;
388 uint32_t group_reporting;
389 uint32_t fadvise_hint;
390 uint32_t fallocate_mode;
391 uint32_t zero_buffers;
392 uint32_t refill_buffers;
393 uint32_t scramble_buffers;
Jens Axboece35b1e2014-01-14 15:35:58 -0700394 uint8_t buffer_pattern[MAX_PATTERN_SIZE];
395 uint32_t buffer_pattern_bytes;
Jens Axboee4769942012-03-13 14:01:11 +0100396 unsigned int compress_percentage;
397 unsigned int compress_chunk;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100398 uint32_t time_based;
399 uint32_t disable_lat;
400 uint32_t disable_clat;
401 uint32_t disable_slat;
402 uint32_t disable_bw;
Jens Axboe95820b62013-01-31 13:23:40 +0100403 uint32_t unified_rw_rep;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100404 uint32_t gtod_reduce;
405 uint32_t gtod_cpu;
406 uint32_t gtod_offload;
407 uint32_t clocksource;
408 uint32_t no_stall;
409 uint32_t trim_percentage;
410 uint32_t trim_batch;
411 uint32_t trim_zero;
412 uint64_t trim_backlog;
413 uint32_t clat_percentiles;
Jens Axboe9db01ef2013-02-07 15:45:39 +0100414 uint32_t percentile_precision;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100415 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
416
417 uint8_t read_iolog_file[FIO_TOP_STR_MAX];
418 uint8_t write_iolog_file[FIO_TOP_STR_MAX];
419 uint8_t bw_log_file[FIO_TOP_STR_MAX];
420 uint8_t lat_log_file[FIO_TOP_STR_MAX];
421 uint8_t iops_log_file[FIO_TOP_STR_MAX];
422 uint8_t replay_redirect[FIO_TOP_STR_MAX];
423
424 /*
425 * Pre-run and post-run shell
426 */
427 uint8_t exec_prerun[FIO_TOP_STR_MAX];
428 uint8_t exec_postrun[FIO_TOP_STR_MAX];
429
Jens Axboeb999b3c2012-09-24 09:39:49 +0200430 uint32_t rate[DDIR_RWDIR_CNT];
431 uint32_t ratemin[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100432 uint32_t ratecycle;
Jens Axboeb999b3c2012-09-24 09:39:49 +0200433 uint32_t rate_iops[DDIR_RWDIR_CNT];
434 uint32_t rate_iops_min[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100435
436 uint8_t ioscheduler[FIO_TOP_STR_MAX];
437
438 /*
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100439 * I/O Error handling
440 */
441 uint32_t continue_on_error;
442
443 /*
444 * Benchmark profile type
445 */
446 uint8_t profile[FIO_TOP_STR_MAX];
447
448 /*
449 * blkio cgroup support
450 */
451 uint8_t cgroup[FIO_TOP_STR_MAX];
452 uint32_t cgroup_weight;
453 uint32_t cgroup_nodelete;
454
455 uint32_t uid;
456 uint32_t gid;
457
458 int32_t flow_id;
459 int32_t flow;
460 int32_t flow_watermark;
461 uint32_t flow_sleep;
462
Jens Axboe6a4cf742012-03-16 14:02:54 +0100463 uint64_t offset_increment;
Jens Axboeddf24e42013-08-09 12:53:44 -0600464 uint64_t number_ios;
Jens Axboe6a4cf742012-03-16 14:02:54 +0100465
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100466 uint32_t sync_file_range;
Jens Axboe3e260a42013-12-09 12:38:53 -0700467
468 uint64_t latency_target;
469 uint64_t latency_window;
470 fio_fp64_t latency_percentile;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100471} __attribute__((packed));
472
473extern void convert_thread_options_to_cpu(struct thread_options *o, struct thread_options_pack *top);
474extern void convert_thread_options_to_net(struct thread_options_pack *top, struct thread_options *);
Jens Axboe51167792012-03-08 21:34:18 +0100475extern int fio_test_cconv(struct thread_options *);
Jens Axboe588b7f02012-03-19 20:37:41 +0100476extern void options_default_fill(struct thread_options *o);
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100477
Jens Axboe8062f522013-04-10 15:01:42 +0200478#endif