Merge branch 'master' into gfio
[fio.git] / thread_options.h
... / ...
CommitLineData
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 */
23enum error_type {
24 ERROR_TYPE_NONE = 0,
25 ERROR_TYPE_READ = 1 << 0,
26 ERROR_TYPE_WRITE = 1 << 1,
27 ERROR_TYPE_VERIFY = 1 << 2,
28 ERROR_TYPE_ANY = 0xffff,
29};
30
31#define BSSPLIT_MAX 64
32
33struct bssplit {
34 uint32_t bs;
35 uint32_t perc;
36};
37
38struct thread_options {
39 int pad;
40 char *description;
41 char *name;
42 char *directory;
43 char *filename;
44 char *opendir;
45 char *ioengine;
46 char *mmapfile;
47 enum td_ddir td_ddir;
48 unsigned int rw_seq;
49 unsigned int kb_base;
50 unsigned int ddir_seq_nr;
51 long ddir_seq_add;
52 unsigned int iodepth;
53 unsigned int iodepth_low;
54 unsigned int iodepth_batch;
55 unsigned int iodepth_batch_complete;
56
57 unsigned long long size;
58 unsigned int size_percent;
59 unsigned int fill_device;
60 unsigned long long file_size_low;
61 unsigned long long file_size_high;
62 unsigned long long start_offset;
63
64 unsigned int bs[DDIR_RWDIR_CNT];
65 unsigned int ba[DDIR_RWDIR_CNT];
66 unsigned int min_bs[DDIR_RWDIR_CNT];
67 unsigned int max_bs[DDIR_RWDIR_CNT];
68 struct bssplit *bssplit[DDIR_RWDIR_CNT];
69 unsigned int bssplit_nr[DDIR_RWDIR_CNT];
70
71 unsigned int nr_files;
72 unsigned int open_files;
73 enum file_lock_mode file_lock_mode;
74 unsigned int lockfile_batch;
75
76 unsigned int odirect;
77 unsigned int invalidate_cache;
78 unsigned int create_serialize;
79 unsigned int create_fsync;
80 unsigned int create_on_open;
81 unsigned int create_only;
82 unsigned int end_fsync;
83 unsigned int pre_read;
84 unsigned int sync_io;
85 unsigned int verify;
86 unsigned int do_verify;
87 unsigned int verifysort;
88 unsigned int verify_interval;
89 unsigned int verify_offset;
90 char verify_pattern[MAX_PATTERN_SIZE];
91 unsigned int verify_pattern_bytes;
92 unsigned int verify_fatal;
93 unsigned int verify_dump;
94 unsigned int verify_async;
95 unsigned long long verify_backlog;
96 unsigned int verify_batch;
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;
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 hugepage_size;
110 unsigned int rw_min_bs;
111 unsigned int thinktime;
112 unsigned int thinktime_spin;
113 unsigned int thinktime_blocks;
114 unsigned int fsync_blocks;
115 unsigned int fdatasync_blocks;
116 unsigned int barrier_blocks;
117 unsigned long long start_delay;
118 unsigned long long timeout;
119 unsigned long long ramp_time;
120 unsigned int overwrite;
121 unsigned int bw_avg_time;
122 unsigned int iops_avg_time;
123 unsigned int loops;
124 unsigned long long zone_range;
125 unsigned long long zone_size;
126 unsigned long long zone_skip;
127 unsigned long long lockmem;
128 enum fio_memtype mem_type;
129 unsigned int mem_align;
130
131 unsigned int stonewall;
132 unsigned int new_group;
133 unsigned int numjobs;
134 os_cpu_mask_t cpumask;
135 unsigned int cpumask_set;
136 os_cpu_mask_t verify_cpumask;
137 unsigned int verify_cpumask_set;
138 unsigned int iolog;
139 unsigned int rwmixcycle;
140 unsigned int rwmix[2];
141 unsigned int nice;
142 unsigned int ioprio;
143 unsigned int ioprio_class;
144 unsigned int file_service_type;
145 unsigned int group_reporting;
146 unsigned int fadvise_hint;
147 enum fio_fallocate_mode fallocate_mode;
148 unsigned int zero_buffers;
149 unsigned int refill_buffers;
150 unsigned int scramble_buffers;
151 unsigned int compress_percentage;
152 unsigned int compress_chunk;
153 unsigned int time_based;
154 unsigned int disable_lat;
155 unsigned int disable_clat;
156 unsigned int disable_slat;
157 unsigned int disable_bw;
158 unsigned int gtod_reduce;
159 unsigned int gtod_cpu;
160 unsigned int gtod_offload;
161 enum fio_cs clocksource;
162 unsigned int no_stall;
163 unsigned int trim_percentage;
164 unsigned int trim_batch;
165 unsigned int trim_zero;
166 unsigned long long trim_backlog;
167 unsigned int clat_percentiles;
168 unsigned int overwrite_plist;
169 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
170
171 char *read_iolog_file;
172 char *write_iolog_file;
173 char *bw_log_file;
174 char *lat_log_file;
175 char *iops_log_file;
176 char *replay_redirect;
177
178 /*
179 * Pre-run and post-run shell
180 */
181 char *exec_prerun;
182 char *exec_postrun;
183
184 unsigned int rate[DDIR_RWDIR_CNT];
185 unsigned int ratemin[DDIR_RWDIR_CNT];
186 unsigned int ratecycle;
187 unsigned int rate_iops[DDIR_RWDIR_CNT];
188 unsigned int rate_iops_min[DDIR_RWDIR_CNT];
189
190 char *ioscheduler;
191
192 /*
193 * I/O Error handling
194 */
195 enum error_type continue_on_error;
196
197 /*
198 * Benchmark profile type
199 */
200 char *profile;
201
202 /*
203 * blkio cgroup support
204 */
205 char *cgroup;
206 unsigned int cgroup_weight;
207 unsigned int cgroup_nodelete;
208
209 unsigned int uid;
210 unsigned int gid;
211
212 int flow_id;
213 int flow;
214 int flow_watermark;
215 unsigned int flow_sleep;
216
217 unsigned long long offset_increment;
218
219 unsigned int sync_file_range;
220};
221
222#define FIO_TOP_STR_MAX 256
223
224struct thread_options_pack {
225 uint8_t description[FIO_TOP_STR_MAX];
226 uint8_t name[FIO_TOP_STR_MAX];
227 uint8_t directory[FIO_TOP_STR_MAX];
228 uint8_t filename[FIO_TOP_STR_MAX];
229 uint8_t opendir[FIO_TOP_STR_MAX];
230 uint8_t ioengine[FIO_TOP_STR_MAX];
231 uint8_t mmapfile[FIO_TOP_STR_MAX];
232 uint32_t td_ddir;
233 uint32_t rw_seq;
234 uint32_t kb_base;
235 uint32_t ddir_seq_nr;
236 uint64_t ddir_seq_add;
237 uint32_t iodepth;
238 uint32_t iodepth_low;
239 uint32_t iodepth_batch;
240 uint32_t iodepth_batch_complete;
241
242 uint64_t size;
243 uint32_t size_percent;
244 uint32_t fill_device;
245 uint64_t file_size_low;
246 uint64_t file_size_high;
247 uint64_t start_offset;
248
249 uint32_t bs[2];
250 uint32_t ba[2];
251 uint32_t min_bs[2];
252 uint32_t max_bs[2];
253 struct bssplit bssplit[2][BSSPLIT_MAX];
254 uint32_t bssplit_nr[2];
255
256 uint32_t nr_files;
257 uint32_t open_files;
258 uint32_t file_lock_mode;
259 uint32_t lockfile_batch;
260
261 uint32_t odirect;
262 uint32_t invalidate_cache;
263 uint32_t create_serialize;
264 uint32_t create_fsync;
265 uint32_t create_on_open;
266 uint32_t create_only;
267 uint32_t end_fsync;
268 uint32_t pre_read;
269 uint32_t sync_io;
270 uint32_t verify;
271 uint32_t do_verify;
272 uint32_t verifysort;
273 uint32_t verify_interval;
274 uint32_t verify_offset;
275 uint8_t verify_pattern[MAX_PATTERN_SIZE];
276 uint32_t verify_pattern_bytes;
277 uint32_t verify_fatal;
278 uint32_t verify_dump;
279 uint32_t verify_async;
280 uint64_t verify_backlog;
281 uint32_t verify_batch;
282 uint32_t use_thread;
283 uint32_t unlink;
284 uint32_t do_disk_util;
285 uint32_t override_sync;
286 uint32_t rand_repeatable;
287 uint32_t use_os_rand;
288 uint32_t log_avg_msec;
289 uint32_t norandommap;
290 uint32_t softrandommap;
291 uint32_t bs_unaligned;
292 uint32_t fsync_on_close;
293
294 uint32_t hugepage_size;
295 uint32_t rw_min_bs;
296 uint32_t thinktime;
297 uint32_t thinktime_spin;
298 uint32_t thinktime_blocks;
299 uint32_t fsync_blocks;
300 uint32_t fdatasync_blocks;
301 uint32_t barrier_blocks;
302 uint64_t start_delay;
303 uint64_t timeout;
304 uint64_t ramp_time;
305 uint32_t overwrite;
306 uint32_t bw_avg_time;
307 uint32_t iops_avg_time;
308 uint32_t loops;
309 uint64_t zone_range;
310 uint64_t zone_size;
311 uint64_t zone_skip;
312 uint64_t lockmem;
313 uint32_t mem_type;
314 uint32_t mem_align;
315
316 uint32_t stonewall;
317 uint32_t new_group;
318 uint32_t numjobs;
319 uint8_t cpumask[FIO_TOP_STR_MAX];
320 uint32_t cpumask_set;
321 uint8_t verify_cpumask[FIO_TOP_STR_MAX];
322 uint32_t verify_cpumask_set;
323 uint32_t iolog;
324 uint32_t rwmixcycle;
325 uint32_t rwmix[2];
326 uint32_t nice;
327 uint32_t ioprio;
328 uint32_t ioprio_class;
329 uint32_t file_service_type;
330 uint32_t group_reporting;
331 uint32_t fadvise_hint;
332 uint32_t fallocate_mode;
333 uint32_t zero_buffers;
334 uint32_t refill_buffers;
335 uint32_t scramble_buffers;
336 unsigned int compress_percentage;
337 unsigned int compress_chunk;
338 uint32_t time_based;
339 uint32_t disable_lat;
340 uint32_t disable_clat;
341 uint32_t disable_slat;
342 uint32_t disable_bw;
343 uint32_t gtod_reduce;
344 uint32_t gtod_cpu;
345 uint32_t gtod_offload;
346 uint32_t clocksource;
347 uint32_t no_stall;
348 uint32_t trim_percentage;
349 uint32_t trim_batch;
350 uint32_t trim_zero;
351 uint64_t trim_backlog;
352 uint32_t clat_percentiles;
353 uint32_t overwrite_plist;
354 fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
355
356 uint8_t read_iolog_file[FIO_TOP_STR_MAX];
357 uint8_t write_iolog_file[FIO_TOP_STR_MAX];
358 uint8_t bw_log_file[FIO_TOP_STR_MAX];
359 uint8_t lat_log_file[FIO_TOP_STR_MAX];
360 uint8_t iops_log_file[FIO_TOP_STR_MAX];
361 uint8_t replay_redirect[FIO_TOP_STR_MAX];
362
363 /*
364 * Pre-run and post-run shell
365 */
366 uint8_t exec_prerun[FIO_TOP_STR_MAX];
367 uint8_t exec_postrun[FIO_TOP_STR_MAX];
368
369 uint32_t rate[2];
370 uint32_t ratemin[2];
371 uint32_t ratecycle;
372 uint32_t rate_iops[2];
373 uint32_t rate_iops_min[2];
374
375 uint8_t ioscheduler[FIO_TOP_STR_MAX];
376
377 /*
378 * I/O Error handling
379 */
380 uint32_t continue_on_error;
381
382 /*
383 * Benchmark profile type
384 */
385 uint8_t profile[FIO_TOP_STR_MAX];
386
387 /*
388 * blkio cgroup support
389 */
390 uint8_t cgroup[FIO_TOP_STR_MAX];
391 uint32_t cgroup_weight;
392 uint32_t cgroup_nodelete;
393
394 uint32_t uid;
395 uint32_t gid;
396
397 int32_t flow_id;
398 int32_t flow;
399 int32_t flow_watermark;
400 uint32_t flow_sleep;
401
402 uint64_t offset_increment;
403
404 uint32_t sync_file_range;
405} __attribute__((packed));
406
407extern void convert_thread_options_to_cpu(struct thread_options *o, struct thread_options_pack *top);
408extern void convert_thread_options_to_net(struct thread_options_pack *top, struct thread_options *);
409extern int fio_test_cconv(struct thread_options *);
410extern void options_default_fill(struct thread_options *o);
411
412#endif