blob: a79494978e3be2c2e0f1ee2a59c0ae350e8e4894 [file] [log] [blame]
Jens Axboeec412652012-03-08 12:37:31 +01001#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"
8
9/*
10 * What type of allocation to use for io buffers
11 */
12enum fio_memtype {
13 MEM_MALLOC = 0, /* ordinary malloc */
14 MEM_SHM, /* use shared memory segments */
15 MEM_SHMHUGE, /* use shared memory segments with huge pages */
16 MEM_MMAP, /* use anonynomous mmap */
17 MEM_MMAPHUGE, /* memory mapped huge file */
18};
19
20/*
21 * What type of errors to continue on when continue_on_error is used
22 */
Jens Axboee65a9502012-09-24 09:24:04 +020023enum error_type_bit {
24 ERROR_TYPE_READ_BIT = 0,
25 ERROR_TYPE_WRITE_BIT = 1,
26 ERROR_TYPE_VERIFY_BIT = 2,
27 ERROR_TYPE_CNT = 3,
28};
29
30#define ERROR_STR_MAX 128
31
Jens Axboeec412652012-03-08 12:37:31 +010032enum error_type {
33 ERROR_TYPE_NONE = 0,
Jens Axboee65a9502012-09-24 09:24:04 +020034 ERROR_TYPE_READ = 1 << ERROR_TYPE_READ_BIT,
35 ERROR_TYPE_WRITE = 1 << ERROR_TYPE_WRITE_BIT,
36 ERROR_TYPE_VERIFY = 1 << ERROR_TYPE_VERIFY_BIT,
Jens Axboeec412652012-03-08 12:37:31 +010037 ERROR_TYPE_ANY = 0xffff,
38};
39
Jens Axboe2dc1cbb2012-03-08 14:52:25 +010040#define BSSPLIT_MAX 64
41
Jens Axboeec412652012-03-08 12:37:31 +010042struct bssplit {
Jens Axboe2dc1cbb2012-03-08 14:52:25 +010043 uint32_t bs;
44 uint32_t perc;
Jens Axboeec412652012-03-08 12:37:31 +010045};
46
47struct thread_options {
48 int pad;
49 char *description;
50 char *name;
51 char *directory;
52 char *filename;
Jens Axboe22f80452013-04-09 20:29:16 +020053 char *filename_format;
Jens Axboeec412652012-03-08 12:37:31 +010054 char *opendir;
55 char *ioengine;
Jens Axboe83ea4222012-03-28 14:01:46 +020056 char *mmapfile;
Jens Axboeec412652012-03-08 12:37:31 +010057 enum td_ddir td_ddir;
58 unsigned int rw_seq;
59 unsigned int kb_base;
Jens Axboe22f80452013-04-09 20:29:16 +020060 unsigned int unit_base;
Jens Axboeec412652012-03-08 12:37:31 +010061 unsigned int ddir_seq_nr;
62 long ddir_seq_add;
63 unsigned int iodepth;
64 unsigned int iodepth_low;
65 unsigned int iodepth_batch;
66 unsigned int iodepth_batch_complete;
67
68 unsigned long long size;
69 unsigned int size_percent;
70 unsigned int fill_device;
71 unsigned long long file_size_low;
72 unsigned long long file_size_high;
73 unsigned long long start_offset;
74
Jens Axboed79db122012-09-24 08:51:24 +020075 unsigned int bs[DDIR_RWDIR_CNT];
76 unsigned int ba[DDIR_RWDIR_CNT];
77 unsigned int min_bs[DDIR_RWDIR_CNT];
78 unsigned int max_bs[DDIR_RWDIR_CNT];
79 struct bssplit *bssplit[DDIR_RWDIR_CNT];
80 unsigned int bssplit_nr[DDIR_RWDIR_CNT];
Jens Axboeec412652012-03-08 12:37:31 +010081
Jens Axboee65a9502012-09-24 09:24:04 +020082 int *ignore_error[ERROR_TYPE_CNT];
83 unsigned int ignore_error_nr[ERROR_TYPE_CNT];
84 unsigned int error_dump;
85
Jens Axboeec412652012-03-08 12:37:31 +010086 unsigned int nr_files;
87 unsigned int open_files;
88 enum file_lock_mode file_lock_mode;
Jens Axboeec412652012-03-08 12:37:31 +010089
90 unsigned int odirect;
91 unsigned int invalidate_cache;
92 unsigned int create_serialize;
93 unsigned int create_fsync;
94 unsigned int create_on_open;
Jens Axboefb390e22012-05-07 09:54:41 +020095 unsigned int create_only;
Jens Axboeec412652012-03-08 12:37:31 +010096 unsigned int end_fsync;
97 unsigned int pre_read;
98 unsigned int sync_io;
99 unsigned int verify;
100 unsigned int do_verify;
101 unsigned int verifysort;
Jens Axboe836fcc02013-01-24 09:08:45 -0700102 unsigned int verifysort_nr;
Jens Axboeec412652012-03-08 12:37:31 +0100103 unsigned int verify_interval;
104 unsigned int verify_offset;
105 char verify_pattern[MAX_PATTERN_SIZE];
106 unsigned int verify_pattern_bytes;
107 unsigned int verify_fatal;
108 unsigned int verify_dump;
109 unsigned int verify_async;
110 unsigned long long verify_backlog;
111 unsigned int verify_batch;
Jens Axboe836fcc02013-01-24 09:08:45 -0700112 unsigned int experimental_verify;
Jens Axboeec412652012-03-08 12:37:31 +0100113 unsigned int use_thread;
114 unsigned int unlink;
115 unsigned int do_disk_util;
116 unsigned int override_sync;
117 unsigned int rand_repeatable;
118 unsigned int use_os_rand;
Jens Axboeec412652012-03-08 12:37:31 +0100119 unsigned int log_avg_msec;
120 unsigned int norandommap;
121 unsigned int softrandommap;
122 unsigned int bs_unaligned;
123 unsigned int fsync_on_close;
124
Jens Axboe1e5324e2012-11-14 14:25:31 -0700125 unsigned int random_distribution;
126 fio_fp64_t zipf_theta;
127 fio_fp64_t pareto_h;
128
Jens Axboe49758e12012-12-03 14:37:23 +0100129 unsigned int random_generator;
130
Jens Axboeec412652012-03-08 12:37:31 +0100131 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;
140 unsigned long long timeout;
141 unsigned long long ramp_time;
142 unsigned int overwrite;
143 unsigned int bw_avg_time;
144 unsigned int iops_avg_time;
145 unsigned int loops;
146 unsigned long long zone_range;
147 unsigned long long zone_size;
148 unsigned long long zone_skip;
Jens Axboe1b79a072012-03-28 20:50:15 +0200149 unsigned long long lockmem;
Jens Axboeec412652012-03-08 12:37:31 +0100150 enum fio_memtype mem_type;
151 unsigned int mem_align;
152
Jens Axboe1e5324e2012-11-14 14:25:31 -0700153 unsigned max_latency;
154
Jens Axboeec412652012-03-08 12:37:31 +0100155 unsigned int stonewall;
156 unsigned int new_group;
157 unsigned int numjobs;
158 os_cpu_mask_t cpumask;
159 unsigned int cpumask_set;
160 os_cpu_mask_t verify_cpumask;
161 unsigned int verify_cpumask_set;
Jens Axboe836fcc02013-01-24 09:08:45 -0700162#ifdef CONFIG_LIBNUMA
Jens Axboe1e5324e2012-11-14 14:25:31 -0700163 struct bitmask *numa_cpunodesmask;
164 unsigned int numa_cpumask_set;
165 unsigned short numa_mem_mode;
166 unsigned int numa_mem_prefer_node;
167 struct bitmask *numa_memnodesmask;
168 unsigned int numa_memmask_set;
169#endif
Jens Axboeec412652012-03-08 12:37:31 +0100170 unsigned int iolog;
171 unsigned int rwmixcycle;
172 unsigned int rwmix[2];
173 unsigned int nice;
Jens Axboe28727df2012-03-29 08:33:15 +0200174 unsigned int ioprio;
175 unsigned int ioprio_class;
Jens Axboeec412652012-03-08 12:37:31 +0100176 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;
Jens Axboee4769942012-03-13 14:01:11 +0100183 unsigned int compress_percentage;
184 unsigned int compress_chunk;
Jens Axboeec412652012-03-08 12:37:31 +0100185 unsigned int time_based;
186 unsigned int disable_lat;
187 unsigned int disable_clat;
188 unsigned int disable_slat;
189 unsigned int disable_bw;
Jens Axboe95820b62013-01-31 13:23:40 +0100190 unsigned int unified_rw_rep;
Jens Axboeec412652012-03-08 12:37:31 +0100191 unsigned int gtod_reduce;
192 unsigned int gtod_cpu;
193 unsigned int gtod_offload;
194 enum fio_cs clocksource;
195 unsigned int no_stall;
196 unsigned int trim_percentage;
197 unsigned int trim_batch;
198 unsigned int trim_zero;
199 unsigned long long trim_backlog;
200 unsigned int clat_percentiles;
Jens Axboe9db01ef2013-02-07 15:45:39 +0100201 unsigned int percentile_precision; /* digits after decimal for percentiles */
Jens Axboeec412652012-03-08 12:37:31 +0100202 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
203
204 char *read_iolog_file;
205 char *write_iolog_file;
206 char *bw_log_file;
207 char *lat_log_file;
208 char *iops_log_file;
209 char *replay_redirect;
210
211 /*
212 * Pre-run and post-run shell
213 */
214 char *exec_prerun;
215 char *exec_postrun;
216
Jens Axboed79db122012-09-24 08:51:24 +0200217 unsigned int rate[DDIR_RWDIR_CNT];
218 unsigned int ratemin[DDIR_RWDIR_CNT];
Jens Axboeec412652012-03-08 12:37:31 +0100219 unsigned int ratecycle;
Jens Axboed79db122012-09-24 08:51:24 +0200220 unsigned int rate_iops[DDIR_RWDIR_CNT];
221 unsigned int rate_iops_min[DDIR_RWDIR_CNT];
Jens Axboeec412652012-03-08 12:37:31 +0100222
223 char *ioscheduler;
224
225 /*
Jens Axboeec412652012-03-08 12:37:31 +0100226 * I/O Error handling
227 */
228 enum error_type continue_on_error;
229
230 /*
231 * Benchmark profile type
232 */
233 char *profile;
234
235 /*
236 * blkio cgroup support
237 */
238 char *cgroup;
239 unsigned int cgroup_weight;
240 unsigned int cgroup_nodelete;
241
242 unsigned int uid;
243 unsigned int gid;
244
245 int flow_id;
246 int flow;
247 int flow_watermark;
248 unsigned int flow_sleep;
249
Jens Axboe6a4cf742012-03-16 14:02:54 +0100250 unsigned long long offset_increment;
251
Jens Axboeec412652012-03-08 12:37:31 +0100252 unsigned int sync_file_range;
253};
254
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100255#define FIO_TOP_STR_MAX 256
256
257struct thread_options_pack {
258 uint8_t description[FIO_TOP_STR_MAX];
259 uint8_t name[FIO_TOP_STR_MAX];
260 uint8_t directory[FIO_TOP_STR_MAX];
261 uint8_t filename[FIO_TOP_STR_MAX];
Jens Axboe22f80452013-04-09 20:29:16 +0200262 uint8_t filename_format[FIO_TOP_STR_MAX];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100263 uint8_t opendir[FIO_TOP_STR_MAX];
264 uint8_t ioengine[FIO_TOP_STR_MAX];
Jens Axboe83ea4222012-03-28 14:01:46 +0200265 uint8_t mmapfile[FIO_TOP_STR_MAX];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100266 uint32_t td_ddir;
267 uint32_t rw_seq;
268 uint32_t kb_base;
Jens Axboe22f80452013-04-09 20:29:16 +0200269 uint32_t unit_base;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100270 uint32_t ddir_seq_nr;
271 uint64_t ddir_seq_add;
272 uint32_t iodepth;
273 uint32_t iodepth_low;
274 uint32_t iodepth_batch;
275 uint32_t iodepth_batch_complete;
276
277 uint64_t size;
278 uint32_t size_percent;
279 uint32_t fill_device;
280 uint64_t file_size_low;
281 uint64_t file_size_high;
282 uint64_t start_offset;
283
Jens Axboeb999b3c2012-09-24 09:39:49 +0200284 uint32_t bs[DDIR_RWDIR_CNT];
285 uint32_t ba[DDIR_RWDIR_CNT];
286 uint32_t min_bs[DDIR_RWDIR_CNT];
287 uint32_t max_bs[DDIR_RWDIR_CNT];
288 struct bssplit bssplit[DDIR_RWDIR_CNT][BSSPLIT_MAX];
289 uint32_t bssplit_nr[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100290
Jens Axboee65a9502012-09-24 09:24:04 +0200291 uint32_t ignore_error[ERROR_TYPE_CNT][ERROR_STR_MAX];
292 uint32_t ignore_error_nr[ERROR_TYPE_CNT];
293 uint32_t error_dump;
294
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100295 uint32_t nr_files;
296 uint32_t open_files;
297 uint32_t file_lock_mode;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100298
299 uint32_t odirect;
300 uint32_t invalidate_cache;
301 uint32_t create_serialize;
302 uint32_t create_fsync;
303 uint32_t create_on_open;
Jens Axboefb390e22012-05-07 09:54:41 +0200304 uint32_t create_only;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100305 uint32_t end_fsync;
306 uint32_t pre_read;
307 uint32_t sync_io;
308 uint32_t verify;
309 uint32_t do_verify;
310 uint32_t verifysort;
Jens Axboe836fcc02013-01-24 09:08:45 -0700311 uint32_t verifysort_nr;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100312 uint32_t verify_interval;
313 uint32_t verify_offset;
314 uint8_t verify_pattern[MAX_PATTERN_SIZE];
315 uint32_t verify_pattern_bytes;
316 uint32_t verify_fatal;
317 uint32_t verify_dump;
318 uint32_t verify_async;
319 uint64_t verify_backlog;
320 uint32_t verify_batch;
Jens Axboe836fcc02013-01-24 09:08:45 -0700321 uint32_t experimental_verify;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100322 uint32_t use_thread;
323 uint32_t unlink;
324 uint32_t do_disk_util;
325 uint32_t override_sync;
326 uint32_t rand_repeatable;
327 uint32_t use_os_rand;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100328 uint32_t log_avg_msec;
329 uint32_t norandommap;
330 uint32_t softrandommap;
331 uint32_t bs_unaligned;
332 uint32_t fsync_on_close;
333
Jens Axboe1e5324e2012-11-14 14:25:31 -0700334 uint32_t random_distribution;
335 fio_fp64_t zipf_theta;
336 fio_fp64_t pareto_h;
337
Jens Axboe49758e12012-12-03 14:37:23 +0100338 uint32_t random_generator;
339
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100340 uint32_t hugepage_size;
341 uint32_t rw_min_bs;
342 uint32_t thinktime;
343 uint32_t thinktime_spin;
344 uint32_t thinktime_blocks;
345 uint32_t fsync_blocks;
346 uint32_t fdatasync_blocks;
347 uint32_t barrier_blocks;
348 uint64_t start_delay;
349 uint64_t timeout;
350 uint64_t ramp_time;
351 uint32_t overwrite;
352 uint32_t bw_avg_time;
353 uint32_t iops_avg_time;
354 uint32_t loops;
355 uint64_t zone_range;
356 uint64_t zone_size;
357 uint64_t zone_skip;
Jens Axboeae278f92012-03-28 20:52:55 +0200358 uint64_t lockmem;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100359 uint32_t mem_type;
360 uint32_t mem_align;
361
Jens Axboe1e5324e2012-11-14 14:25:31 -0700362 uint32_t max_latency;
363
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100364 uint32_t stonewall;
365 uint32_t new_group;
366 uint32_t numjobs;
367 uint8_t cpumask[FIO_TOP_STR_MAX];
368 uint32_t cpumask_set;
369 uint8_t verify_cpumask[FIO_TOP_STR_MAX];
370 uint32_t verify_cpumask_set;
371 uint32_t iolog;
372 uint32_t rwmixcycle;
373 uint32_t rwmix[2];
374 uint32_t nice;
Jens Axboe28727df2012-03-29 08:33:15 +0200375 uint32_t ioprio;
376 uint32_t ioprio_class;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100377 uint32_t file_service_type;
378 uint32_t group_reporting;
379 uint32_t fadvise_hint;
380 uint32_t fallocate_mode;
381 uint32_t zero_buffers;
382 uint32_t refill_buffers;
383 uint32_t scramble_buffers;
Jens Axboee4769942012-03-13 14:01:11 +0100384 unsigned int compress_percentage;
385 unsigned int compress_chunk;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100386 uint32_t time_based;
387 uint32_t disable_lat;
388 uint32_t disable_clat;
389 uint32_t disable_slat;
390 uint32_t disable_bw;
Jens Axboe95820b62013-01-31 13:23:40 +0100391 uint32_t unified_rw_rep;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100392 uint32_t gtod_reduce;
393 uint32_t gtod_cpu;
394 uint32_t gtod_offload;
395 uint32_t clocksource;
396 uint32_t no_stall;
397 uint32_t trim_percentage;
398 uint32_t trim_batch;
399 uint32_t trim_zero;
400 uint64_t trim_backlog;
401 uint32_t clat_percentiles;
Jens Axboe9db01ef2013-02-07 15:45:39 +0100402 uint32_t percentile_precision;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100403 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
404
405 uint8_t read_iolog_file[FIO_TOP_STR_MAX];
406 uint8_t write_iolog_file[FIO_TOP_STR_MAX];
407 uint8_t bw_log_file[FIO_TOP_STR_MAX];
408 uint8_t lat_log_file[FIO_TOP_STR_MAX];
409 uint8_t iops_log_file[FIO_TOP_STR_MAX];
410 uint8_t replay_redirect[FIO_TOP_STR_MAX];
411
412 /*
413 * Pre-run and post-run shell
414 */
415 uint8_t exec_prerun[FIO_TOP_STR_MAX];
416 uint8_t exec_postrun[FIO_TOP_STR_MAX];
417
Jens Axboeb999b3c2012-09-24 09:39:49 +0200418 uint32_t rate[DDIR_RWDIR_CNT];
419 uint32_t ratemin[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100420 uint32_t ratecycle;
Jens Axboeb999b3c2012-09-24 09:39:49 +0200421 uint32_t rate_iops[DDIR_RWDIR_CNT];
422 uint32_t rate_iops_min[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100423
424 uint8_t ioscheduler[FIO_TOP_STR_MAX];
425
426 /*
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100427 * I/O Error handling
428 */
429 uint32_t continue_on_error;
430
431 /*
432 * Benchmark profile type
433 */
434 uint8_t profile[FIO_TOP_STR_MAX];
435
436 /*
437 * blkio cgroup support
438 */
439 uint8_t cgroup[FIO_TOP_STR_MAX];
440 uint32_t cgroup_weight;
441 uint32_t cgroup_nodelete;
442
443 uint32_t uid;
444 uint32_t gid;
445
446 int32_t flow_id;
447 int32_t flow;
448 int32_t flow_watermark;
449 uint32_t flow_sleep;
450
Jens Axboe6a4cf742012-03-16 14:02:54 +0100451 uint64_t offset_increment;
452
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100453 uint32_t sync_file_range;
454} __attribute__((packed));
455
456extern void convert_thread_options_to_cpu(struct thread_options *o, struct thread_options_pack *top);
457extern void convert_thread_options_to_net(struct thread_options_pack *top, struct thread_options *);
Jens Axboe51167792012-03-08 21:34:18 +0100458extern int fio_test_cconv(struct thread_options *);
Jens Axboe588b7f02012-03-19 20:37:41 +0100459extern void options_default_fill(struct thread_options *o);
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100460
Jens Axboeec412652012-03-08 12:37:31 +0100461#endif