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