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