blob: ae83f08a2b20023cee0b51562fff1e5ff34ff78d [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;
53 char *opendir;
54 char *ioengine;
Jens Axboe83ea4222012-03-28 14:01:46 +020055 char *mmapfile;
Jens Axboeec412652012-03-08 12:37:31 +010056 enum td_ddir td_ddir;
57 unsigned int rw_seq;
58 unsigned int kb_base;
59 unsigned int ddir_seq_nr;
60 long ddir_seq_add;
61 unsigned int iodepth;
62 unsigned int iodepth_low;
63 unsigned int iodepth_batch;
64 unsigned int iodepth_batch_complete;
65
66 unsigned long long size;
67 unsigned int size_percent;
68 unsigned int fill_device;
69 unsigned long long file_size_low;
70 unsigned long long file_size_high;
71 unsigned long long start_offset;
72
Jens Axboed79db122012-09-24 08:51:24 +020073 unsigned int bs[DDIR_RWDIR_CNT];
74 unsigned int ba[DDIR_RWDIR_CNT];
75 unsigned int min_bs[DDIR_RWDIR_CNT];
76 unsigned int max_bs[DDIR_RWDIR_CNT];
77 struct bssplit *bssplit[DDIR_RWDIR_CNT];
78 unsigned int bssplit_nr[DDIR_RWDIR_CNT];
Jens Axboeec412652012-03-08 12:37:31 +010079
Jens Axboee65a9502012-09-24 09:24:04 +020080 int *ignore_error[ERROR_TYPE_CNT];
81 unsigned int ignore_error_nr[ERROR_TYPE_CNT];
82 unsigned int error_dump;
83
Jens Axboeec412652012-03-08 12:37:31 +010084 unsigned int nr_files;
85 unsigned int open_files;
86 enum file_lock_mode file_lock_mode;
87 unsigned int lockfile_batch;
88
89 unsigned int odirect;
90 unsigned int invalidate_cache;
91 unsigned int create_serialize;
92 unsigned int create_fsync;
93 unsigned int create_on_open;
Jens Axboefb390e22012-05-07 09:54:41 +020094 unsigned int create_only;
Jens Axboeec412652012-03-08 12:37:31 +010095 unsigned int end_fsync;
96 unsigned int pre_read;
97 unsigned int sync_io;
98 unsigned int verify;
99 unsigned int do_verify;
100 unsigned int verifysort;
Jens Axboe836fcc02013-01-24 09:08:45 -0700101 unsigned int verifysort_nr;
Jens Axboeec412652012-03-08 12:37:31 +0100102 unsigned int verify_interval;
103 unsigned int verify_offset;
104 char verify_pattern[MAX_PATTERN_SIZE];
105 unsigned int verify_pattern_bytes;
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;
Jens Axboe836fcc02013-01-24 09:08:45 -0700111 unsigned int experimental_verify;
Jens Axboeec412652012-03-08 12:37:31 +0100112 unsigned int use_thread;
113 unsigned int unlink;
114 unsigned int do_disk_util;
115 unsigned int override_sync;
116 unsigned int rand_repeatable;
117 unsigned int use_os_rand;
Jens Axboeec412652012-03-08 12:37:31 +0100118 unsigned int log_avg_msec;
119 unsigned int norandommap;
120 unsigned int softrandommap;
121 unsigned int bs_unaligned;
122 unsigned int fsync_on_close;
123
Jens Axboe1e5324e2012-11-14 14:25:31 -0700124 unsigned int random_distribution;
125 fio_fp64_t zipf_theta;
126 fio_fp64_t pareto_h;
127
Jens Axboe49758e12012-12-03 14:37:23 +0100128 unsigned int random_generator;
129
Jens Axboeec412652012-03-08 12:37:31 +0100130 unsigned int hugepage_size;
131 unsigned int rw_min_bs;
132 unsigned int thinktime;
133 unsigned int thinktime_spin;
134 unsigned int thinktime_blocks;
135 unsigned int fsync_blocks;
136 unsigned int fdatasync_blocks;
137 unsigned int barrier_blocks;
138 unsigned long long start_delay;
139 unsigned long long timeout;
140 unsigned long long ramp_time;
141 unsigned int overwrite;
142 unsigned int bw_avg_time;
143 unsigned int iops_avg_time;
144 unsigned int loops;
145 unsigned long long zone_range;
146 unsigned long long zone_size;
147 unsigned long long zone_skip;
Jens Axboe1b79a072012-03-28 20:50:15 +0200148 unsigned long long lockmem;
Jens Axboeec412652012-03-08 12:37:31 +0100149 enum fio_memtype mem_type;
150 unsigned int mem_align;
151
Jens Axboe1e5324e2012-11-14 14:25:31 -0700152 unsigned max_latency;
153
Jens Axboeec412652012-03-08 12:37:31 +0100154 unsigned int stonewall;
155 unsigned int new_group;
156 unsigned int numjobs;
157 os_cpu_mask_t cpumask;
158 unsigned int cpumask_set;
159 os_cpu_mask_t verify_cpumask;
160 unsigned int verify_cpumask_set;
Jens Axboe836fcc02013-01-24 09:08:45 -0700161#ifdef CONFIG_LIBNUMA
Jens Axboe1e5324e2012-11-14 14:25:31 -0700162 struct bitmask *numa_cpunodesmask;
163 unsigned int numa_cpumask_set;
164 unsigned short numa_mem_mode;
165 unsigned int numa_mem_prefer_node;
166 struct bitmask *numa_memnodesmask;
167 unsigned int numa_memmask_set;
168#endif
Jens Axboeec412652012-03-08 12:37:31 +0100169 unsigned int iolog;
170 unsigned int rwmixcycle;
171 unsigned int rwmix[2];
172 unsigned int nice;
Jens Axboe28727df2012-03-29 08:33:15 +0200173 unsigned int ioprio;
174 unsigned int ioprio_class;
Jens Axboeec412652012-03-08 12:37:31 +0100175 unsigned int file_service_type;
176 unsigned int group_reporting;
177 unsigned int fadvise_hint;
178 enum fio_fallocate_mode fallocate_mode;
179 unsigned int zero_buffers;
180 unsigned int refill_buffers;
181 unsigned int scramble_buffers;
Jens Axboee4769942012-03-13 14:01:11 +0100182 unsigned int compress_percentage;
183 unsigned int compress_chunk;
Jens Axboeec412652012-03-08 12:37:31 +0100184 unsigned int time_based;
185 unsigned int disable_lat;
186 unsigned int disable_clat;
187 unsigned int disable_slat;
188 unsigned int disable_bw;
Jens Axboe95820b62013-01-31 13:23:40 +0100189 unsigned int unified_rw_rep;
Jens Axboeec412652012-03-08 12:37:31 +0100190 unsigned int gtod_reduce;
191 unsigned int gtod_cpu;
192 unsigned int gtod_offload;
193 enum fio_cs clocksource;
194 unsigned int no_stall;
195 unsigned int trim_percentage;
196 unsigned int trim_batch;
197 unsigned int trim_zero;
198 unsigned long long trim_backlog;
199 unsigned int clat_percentiles;
200 unsigned int overwrite_plist;
201 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
202
203 char *read_iolog_file;
204 char *write_iolog_file;
205 char *bw_log_file;
206 char *lat_log_file;
207 char *iops_log_file;
208 char *replay_redirect;
209
210 /*
211 * Pre-run and post-run shell
212 */
213 char *exec_prerun;
214 char *exec_postrun;
215
Jens Axboed79db122012-09-24 08:51:24 +0200216 unsigned int rate[DDIR_RWDIR_CNT];
217 unsigned int ratemin[DDIR_RWDIR_CNT];
Jens Axboeec412652012-03-08 12:37:31 +0100218 unsigned int ratecycle;
Jens Axboed79db122012-09-24 08:51:24 +0200219 unsigned int rate_iops[DDIR_RWDIR_CNT];
220 unsigned int rate_iops_min[DDIR_RWDIR_CNT];
Jens Axboeec412652012-03-08 12:37:31 +0100221
222 char *ioscheduler;
223
224 /*
Jens Axboeec412652012-03-08 12:37:31 +0100225 * I/O Error handling
226 */
227 enum error_type continue_on_error;
228
229 /*
230 * Benchmark profile type
231 */
232 char *profile;
233
234 /*
235 * blkio cgroup support
236 */
237 char *cgroup;
238 unsigned int cgroup_weight;
239 unsigned int cgroup_nodelete;
240
241 unsigned int uid;
242 unsigned int gid;
243
244 int flow_id;
245 int flow;
246 int flow_watermark;
247 unsigned int flow_sleep;
248
Jens Axboe6a4cf742012-03-16 14:02:54 +0100249 unsigned long long offset_increment;
250
Jens Axboeec412652012-03-08 12:37:31 +0100251 unsigned int sync_file_range;
252};
253
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100254#define FIO_TOP_STR_MAX 256
255
256struct thread_options_pack {
257 uint8_t description[FIO_TOP_STR_MAX];
258 uint8_t name[FIO_TOP_STR_MAX];
259 uint8_t directory[FIO_TOP_STR_MAX];
260 uint8_t filename[FIO_TOP_STR_MAX];
261 uint8_t opendir[FIO_TOP_STR_MAX];
262 uint8_t ioengine[FIO_TOP_STR_MAX];
Jens Axboe83ea4222012-03-28 14:01:46 +0200263 uint8_t mmapfile[FIO_TOP_STR_MAX];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100264 uint32_t td_ddir;
265 uint32_t rw_seq;
266 uint32_t kb_base;
267 uint32_t ddir_seq_nr;
268 uint64_t ddir_seq_add;
269 uint32_t iodepth;
270 uint32_t iodepth_low;
271 uint32_t iodepth_batch;
272 uint32_t iodepth_batch_complete;
273
274 uint64_t size;
275 uint32_t size_percent;
276 uint32_t fill_device;
277 uint64_t file_size_low;
278 uint64_t file_size_high;
279 uint64_t start_offset;
280
Jens Axboeb999b3c2012-09-24 09:39:49 +0200281 uint32_t bs[DDIR_RWDIR_CNT];
282 uint32_t ba[DDIR_RWDIR_CNT];
283 uint32_t min_bs[DDIR_RWDIR_CNT];
284 uint32_t max_bs[DDIR_RWDIR_CNT];
285 struct bssplit bssplit[DDIR_RWDIR_CNT][BSSPLIT_MAX];
286 uint32_t bssplit_nr[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100287
Jens Axboee65a9502012-09-24 09:24:04 +0200288 uint32_t ignore_error[ERROR_TYPE_CNT][ERROR_STR_MAX];
289 uint32_t ignore_error_nr[ERROR_TYPE_CNT];
290 uint32_t error_dump;
291
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100292 uint32_t nr_files;
293 uint32_t open_files;
294 uint32_t file_lock_mode;
295 uint32_t lockfile_batch;
296
297 uint32_t odirect;
298 uint32_t invalidate_cache;
299 uint32_t create_serialize;
300 uint32_t create_fsync;
301 uint32_t create_on_open;
Jens Axboefb390e22012-05-07 09:54:41 +0200302 uint32_t create_only;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100303 uint32_t end_fsync;
304 uint32_t pre_read;
305 uint32_t sync_io;
306 uint32_t verify;
307 uint32_t do_verify;
308 uint32_t verifysort;
Jens Axboe836fcc02013-01-24 09:08:45 -0700309 uint32_t verifysort_nr;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100310 uint32_t verify_interval;
311 uint32_t verify_offset;
312 uint8_t verify_pattern[MAX_PATTERN_SIZE];
313 uint32_t verify_pattern_bytes;
314 uint32_t verify_fatal;
315 uint32_t verify_dump;
316 uint32_t verify_async;
317 uint64_t verify_backlog;
318 uint32_t verify_batch;
Jens Axboe836fcc02013-01-24 09:08:45 -0700319 uint32_t experimental_verify;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100320 uint32_t use_thread;
321 uint32_t unlink;
322 uint32_t do_disk_util;
323 uint32_t override_sync;
324 uint32_t rand_repeatable;
325 uint32_t use_os_rand;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100326 uint32_t log_avg_msec;
327 uint32_t norandommap;
328 uint32_t softrandommap;
329 uint32_t bs_unaligned;
330 uint32_t fsync_on_close;
331
Jens Axboe1e5324e2012-11-14 14:25:31 -0700332 uint32_t random_distribution;
333 fio_fp64_t zipf_theta;
334 fio_fp64_t pareto_h;
335
Jens Axboe49758e12012-12-03 14:37:23 +0100336 uint32_t random_generator;
337
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100338 uint32_t hugepage_size;
339 uint32_t rw_min_bs;
340 uint32_t thinktime;
341 uint32_t thinktime_spin;
342 uint32_t thinktime_blocks;
343 uint32_t fsync_blocks;
344 uint32_t fdatasync_blocks;
345 uint32_t barrier_blocks;
346 uint64_t start_delay;
347 uint64_t timeout;
348 uint64_t ramp_time;
349 uint32_t overwrite;
350 uint32_t bw_avg_time;
351 uint32_t iops_avg_time;
352 uint32_t loops;
353 uint64_t zone_range;
354 uint64_t zone_size;
355 uint64_t zone_skip;
Jens Axboeae278f92012-03-28 20:52:55 +0200356 uint64_t lockmem;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100357 uint32_t mem_type;
358 uint32_t mem_align;
359
Jens Axboe1e5324e2012-11-14 14:25:31 -0700360 uint32_t max_latency;
361
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100362 uint32_t stonewall;
363 uint32_t new_group;
364 uint32_t numjobs;
365 uint8_t cpumask[FIO_TOP_STR_MAX];
366 uint32_t cpumask_set;
367 uint8_t verify_cpumask[FIO_TOP_STR_MAX];
368 uint32_t verify_cpumask_set;
369 uint32_t iolog;
370 uint32_t rwmixcycle;
371 uint32_t rwmix[2];
372 uint32_t nice;
Jens Axboe28727df2012-03-29 08:33:15 +0200373 uint32_t ioprio;
374 uint32_t ioprio_class;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100375 uint32_t file_service_type;
376 uint32_t group_reporting;
377 uint32_t fadvise_hint;
378 uint32_t fallocate_mode;
379 uint32_t zero_buffers;
380 uint32_t refill_buffers;
381 uint32_t scramble_buffers;
Jens Axboee4769942012-03-13 14:01:11 +0100382 unsigned int compress_percentage;
383 unsigned int compress_chunk;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100384 uint32_t time_based;
385 uint32_t disable_lat;
386 uint32_t disable_clat;
387 uint32_t disable_slat;
388 uint32_t disable_bw;
Jens Axboe95820b62013-01-31 13:23:40 +0100389 uint32_t unified_rw_rep;
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100390 uint32_t gtod_reduce;
391 uint32_t gtod_cpu;
392 uint32_t gtod_offload;
393 uint32_t clocksource;
394 uint32_t no_stall;
395 uint32_t trim_percentage;
396 uint32_t trim_batch;
397 uint32_t trim_zero;
398 uint64_t trim_backlog;
399 uint32_t clat_percentiles;
400 uint32_t overwrite_plist;
401 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
402
403 uint8_t read_iolog_file[FIO_TOP_STR_MAX];
404 uint8_t write_iolog_file[FIO_TOP_STR_MAX];
405 uint8_t bw_log_file[FIO_TOP_STR_MAX];
406 uint8_t lat_log_file[FIO_TOP_STR_MAX];
407 uint8_t iops_log_file[FIO_TOP_STR_MAX];
408 uint8_t replay_redirect[FIO_TOP_STR_MAX];
409
410 /*
411 * Pre-run and post-run shell
412 */
413 uint8_t exec_prerun[FIO_TOP_STR_MAX];
414 uint8_t exec_postrun[FIO_TOP_STR_MAX];
415
Jens Axboeb999b3c2012-09-24 09:39:49 +0200416 uint32_t rate[DDIR_RWDIR_CNT];
417 uint32_t ratemin[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100418 uint32_t ratecycle;
Jens Axboeb999b3c2012-09-24 09:39:49 +0200419 uint32_t rate_iops[DDIR_RWDIR_CNT];
420 uint32_t rate_iops_min[DDIR_RWDIR_CNT];
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100421
422 uint8_t ioscheduler[FIO_TOP_STR_MAX];
423
424 /*
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100425 * I/O Error handling
426 */
427 uint32_t continue_on_error;
428
429 /*
430 * Benchmark profile type
431 */
432 uint8_t profile[FIO_TOP_STR_MAX];
433
434 /*
435 * blkio cgroup support
436 */
437 uint8_t cgroup[FIO_TOP_STR_MAX];
438 uint32_t cgroup_weight;
439 uint32_t cgroup_nodelete;
440
441 uint32_t uid;
442 uint32_t gid;
443
444 int32_t flow_id;
445 int32_t flow;
446 int32_t flow_watermark;
447 uint32_t flow_sleep;
448
Jens Axboe6a4cf742012-03-16 14:02:54 +0100449 uint64_t offset_increment;
450
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100451 uint32_t sync_file_range;
452} __attribute__((packed));
453
454extern void convert_thread_options_to_cpu(struct thread_options *o, struct thread_options_pack *top);
455extern void convert_thread_options_to_net(struct thread_options_pack *top, struct thread_options *);
Jens Axboe51167792012-03-08 21:34:18 +0100456extern int fio_test_cconv(struct thread_options *);
Jens Axboe588b7f02012-03-19 20:37:41 +0100457extern void options_default_fill(struct thread_options *o);
Jens Axboe2dc1cbb2012-03-08 14:52:25 +0100458
Jens Axboeec412652012-03-08 12:37:31 +0100459#endif