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