fio.1 - escape the escape character so it shows up
[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 #include "lib/ieee754.h"
9 #include "td_error.h"
10
11 /*
12  * What type of allocation to use for io buffers
13  */
14 enum fio_memtype {
15         MEM_MALLOC = 0, /* ordinary malloc */
16         MEM_SHM,        /* use shared memory segments */
17         MEM_SHMHUGE,    /* use shared memory segments with huge pages */
18         MEM_MMAP,       /* use anonynomous mmap */
19         MEM_MMAPHUGE,   /* memory mapped huge file */
20 };
21
22 #define ERROR_STR_MAX   128
23
24 #define BSSPLIT_MAX     64
25
26 struct bssplit {
27         uint32_t bs;
28         uint32_t perc;
29 };
30
31 #define OPT_MAGIC       0x4f50544e
32
33 struct thread_options {
34         int magic;
35         char *description;
36         char *name;
37         char *directory;
38         char *filename;
39         char *filename_format;
40         char *opendir;
41         char *ioengine;
42         char *mmapfile;
43         enum td_ddir td_ddir;
44         unsigned int rw_seq;
45         unsigned int kb_base;
46         unsigned int unit_base;
47         unsigned int ddir_seq_nr;
48         long long ddir_seq_add;
49         unsigned int iodepth;
50         unsigned int iodepth_low;
51         unsigned int iodepth_batch;
52         unsigned int iodepth_batch_complete;
53
54         unsigned long long size;
55         unsigned long long io_limit;
56         unsigned int size_percent;
57         unsigned int fill_device;
58         unsigned int file_append;
59         unsigned long long file_size_low;
60         unsigned long long file_size_high;
61         unsigned long long start_offset;
62
63         unsigned int bs[DDIR_RWDIR_CNT];
64         unsigned int ba[DDIR_RWDIR_CNT];
65         unsigned int min_bs[DDIR_RWDIR_CNT];
66         unsigned int max_bs[DDIR_RWDIR_CNT];
67         struct bssplit *bssplit[DDIR_RWDIR_CNT];
68         unsigned int bssplit_nr[DDIR_RWDIR_CNT];
69
70         int *ignore_error[ERROR_TYPE_CNT];
71         unsigned int ignore_error_nr[ERROR_TYPE_CNT];
72         unsigned int error_dump;
73
74         unsigned int nr_files;
75         unsigned int open_files;
76         enum file_lock_mode file_lock_mode;
77
78         unsigned int odirect;
79         unsigned int oatomic;
80         unsigned int invalidate_cache;
81         unsigned int create_serialize;
82         unsigned int create_fsync;
83         unsigned int create_on_open;
84         unsigned int create_only;
85         unsigned int end_fsync;
86         unsigned int pre_read;
87         unsigned int sync_io;
88         unsigned int verify;
89         unsigned int do_verify;
90         unsigned int verifysort;
91         unsigned int verifysort_nr;
92         unsigned int verify_interval;
93         unsigned int verify_offset;
94         char verify_pattern[MAX_PATTERN_SIZE];
95         unsigned int verify_pattern_bytes;
96         unsigned int verify_fatal;
97         unsigned int verify_dump;
98         unsigned int verify_async;
99         unsigned long long verify_backlog;
100         unsigned int verify_batch;
101         unsigned int experimental_verify;
102         unsigned int use_thread;
103         unsigned int unlink;
104         unsigned int do_disk_util;
105         unsigned int override_sync;
106         unsigned int rand_repeatable;
107         unsigned int allrand_repeatable;
108         unsigned long long rand_seed;
109         unsigned int use_os_rand;
110         unsigned int log_avg_msec;
111         unsigned int log_offset;
112         unsigned int log_gz;
113         unsigned int norandommap;
114         unsigned int softrandommap;
115         unsigned int bs_unaligned;
116         unsigned int fsync_on_close;
117         unsigned int bs_is_seq_rand;
118
119         unsigned int verify_only;
120
121         unsigned int random_distribution;
122
123         fio_fp64_t zipf_theta;
124         fio_fp64_t pareto_h;
125
126         unsigned int random_generator;
127
128         unsigned int perc_rand[DDIR_RWDIR_CNT];
129
130         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 start_delay_high;
140         unsigned long long timeout;
141         unsigned long long ramp_time;
142         unsigned int overwrite;
143         unsigned int bw_avg_time;
144         unsigned int iops_avg_time;
145         unsigned int loops;
146         unsigned long long zone_range;
147         unsigned long long zone_size;
148         unsigned long long zone_skip;
149         unsigned long long lockmem;
150         enum fio_memtype mem_type;
151         unsigned int mem_align;
152
153         unsigned int max_latency;
154
155         unsigned int stonewall;
156         unsigned int new_group;
157         unsigned int numjobs;
158         os_cpu_mask_t cpumask;
159         unsigned int cpumask_set;
160         os_cpu_mask_t verify_cpumask;
161         unsigned int verify_cpumask_set;
162         unsigned int cpus_allowed_policy;
163         char *numa_cpunodes;
164         unsigned int numa_cpumask_set;
165         unsigned short numa_mem_mode;
166         unsigned int numa_mem_prefer_node;
167         char *numa_memnodes;
168         unsigned int numa_memmask_set;
169         unsigned int iolog;
170         unsigned int rwmixcycle;
171         unsigned int rwmix[DDIR_RWDIR_CNT];
172         unsigned int nice;
173         unsigned int ioprio;
174         unsigned int ioprio_class;
175         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;
182         char buffer_pattern[MAX_PATTERN_SIZE];
183         unsigned int buffer_pattern_bytes;
184         unsigned int compress_percentage;
185         unsigned int compress_chunk;
186         unsigned int time_based;
187         unsigned int disable_lat;
188         unsigned int disable_clat;
189         unsigned int disable_slat;
190         unsigned int disable_bw;
191         unsigned int unified_rw_rep;
192         unsigned int gtod_reduce;
193         unsigned int gtod_cpu;
194         unsigned int gtod_offload;
195         enum fio_cs clocksource;
196         unsigned int no_stall;
197         unsigned int trim_percentage;
198         unsigned int trim_batch;
199         unsigned int trim_zero;
200         unsigned long long trim_backlog;
201         unsigned int clat_percentiles;
202         unsigned int percentile_precision;      /* digits after decimal for percentiles */
203         fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
204
205         char *read_iolog_file;
206         char *write_iolog_file;
207         char *bw_log_file;
208         char *lat_log_file;
209         char *iops_log_file;
210         char *replay_redirect;
211
212         /*
213          * Pre-run and post-run shell
214          */
215         char *exec_prerun;
216         char *exec_postrun;
217
218         unsigned int rate[DDIR_RWDIR_CNT];
219         unsigned int ratemin[DDIR_RWDIR_CNT];
220         unsigned int ratecycle;
221         unsigned int rate_iops[DDIR_RWDIR_CNT];
222         unsigned int rate_iops_min[DDIR_RWDIR_CNT];
223
224         char *ioscheduler;
225
226         /*
227          * I/O Error handling
228          */
229         enum error_type continue_on_error;
230
231         /*
232          * Benchmark profile type
233          */
234         char *profile;
235
236         /*
237          * blkio cgroup support
238          */
239         char *cgroup;
240         unsigned int cgroup_weight;
241         unsigned int cgroup_nodelete;
242
243         unsigned int uid;
244         unsigned int gid;
245
246         int flow_id;
247         int flow;
248         int flow_watermark;
249         unsigned int flow_sleep;
250
251         unsigned long long offset_increment;
252         unsigned long long number_ios;
253
254         unsigned int sync_file_range;
255
256         unsigned long long latency_target;
257         unsigned long long latency_window;
258         fio_fp64_t latency_percentile;
259 };
260
261 #define FIO_TOP_STR_MAX         256
262
263 struct thread_options_pack {
264         uint8_t description[FIO_TOP_STR_MAX];
265         uint8_t name[FIO_TOP_STR_MAX];
266         uint8_t directory[FIO_TOP_STR_MAX];
267         uint8_t filename[FIO_TOP_STR_MAX];
268         uint8_t filename_format[FIO_TOP_STR_MAX];
269         uint8_t opendir[FIO_TOP_STR_MAX];
270         uint8_t ioengine[FIO_TOP_STR_MAX];
271         uint8_t mmapfile[FIO_TOP_STR_MAX];
272         uint32_t td_ddir;
273         uint32_t rw_seq;
274         uint32_t kb_base;
275         uint32_t unit_base;
276         uint32_t ddir_seq_nr;
277         uint64_t ddir_seq_add;
278         uint32_t iodepth;
279         uint32_t iodepth_low;
280         uint32_t iodepth_batch;
281         uint32_t iodepth_batch_complete;
282
283         uint64_t size;
284         uint64_t io_limit;
285         uint32_t size_percent;
286         uint32_t fill_device;
287         uint32_t file_append;
288         uint64_t file_size_low;
289         uint64_t file_size_high;
290         uint64_t start_offset;
291
292         uint32_t bs[DDIR_RWDIR_CNT];
293         uint32_t ba[DDIR_RWDIR_CNT];
294         uint32_t min_bs[DDIR_RWDIR_CNT];
295         uint32_t max_bs[DDIR_RWDIR_CNT];
296         struct bssplit bssplit[DDIR_RWDIR_CNT][BSSPLIT_MAX];
297         uint32_t bssplit_nr[DDIR_RWDIR_CNT];
298
299         uint32_t ignore_error[ERROR_TYPE_CNT][ERROR_STR_MAX];
300         uint32_t ignore_error_nr[ERROR_TYPE_CNT];
301         uint32_t error_dump;
302
303         uint32_t nr_files;
304         uint32_t open_files;
305         uint32_t file_lock_mode;
306
307         uint32_t odirect;
308         uint32_t oatomic;
309         uint32_t invalidate_cache;
310         uint32_t create_serialize;
311         uint32_t create_fsync;
312         uint32_t create_on_open;
313         uint32_t create_only;
314         uint32_t end_fsync;
315         uint32_t pre_read;
316         uint32_t sync_io;
317         uint32_t verify;
318         uint32_t do_verify;
319         uint32_t verifysort;
320         uint32_t verifysort_nr;
321         uint32_t verify_interval;
322         uint32_t verify_offset;
323         uint8_t verify_pattern[MAX_PATTERN_SIZE];
324         uint32_t verify_pattern_bytes;
325         uint32_t verify_fatal;
326         uint32_t verify_dump;
327         uint32_t verify_async;
328         uint64_t verify_backlog;
329         uint32_t verify_batch;
330         uint32_t experimental_verify;
331         uint32_t use_thread;
332         uint32_t unlink;
333         uint32_t do_disk_util;
334         uint32_t override_sync;
335         uint32_t rand_repeatable;
336         uint32_t allrand_repeatable;
337         uint64_t rand_seed;
338         uint32_t use_os_rand;
339         uint32_t log_avg_msec;
340         uint32_t log_offset;
341         uint32_t log_gz;
342         uint32_t norandommap;
343         uint32_t softrandommap;
344         uint32_t bs_unaligned;
345         uint32_t fsync_on_close;
346         uint32_t bs_is_seq_rand;
347
348         uint32_t random_distribution;
349         fio_fp64_t zipf_theta;
350         fio_fp64_t pareto_h;
351
352         uint32_t random_generator;
353
354         uint32_t perc_rand[DDIR_RWDIR_CNT];
355
356         uint32_t hugepage_size;
357         uint32_t rw_min_bs;
358         uint32_t thinktime;
359         uint32_t thinktime_spin;
360         uint32_t thinktime_blocks;
361         uint32_t fsync_blocks;
362         uint32_t fdatasync_blocks;
363         uint32_t barrier_blocks;
364         uint64_t start_delay;
365         uint64_t start_delay_high;
366         uint64_t timeout;
367         uint64_t ramp_time;
368         uint32_t overwrite;
369         uint32_t bw_avg_time;
370         uint32_t iops_avg_time;
371         uint32_t loops;
372         uint64_t zone_range;
373         uint64_t zone_size;
374         uint64_t zone_skip;
375         uint64_t lockmem;
376         uint32_t mem_type;
377         uint32_t mem_align;
378
379         uint32_t max_latency;
380
381         uint32_t stonewall;
382         uint32_t new_group;
383         uint32_t numjobs;
384         uint8_t cpumask[FIO_TOP_STR_MAX];
385         uint32_t cpumask_set;
386         uint8_t verify_cpumask[FIO_TOP_STR_MAX];
387         uint32_t verify_cpumask_set;
388         uint32_t cpus_allowed_policy;
389         uint32_t iolog;
390         uint32_t rwmixcycle;
391         uint32_t rwmix[DDIR_RWDIR_CNT];
392         uint32_t nice;
393         uint32_t ioprio;
394         uint32_t ioprio_class;
395         uint32_t file_service_type;
396         uint32_t group_reporting;
397         uint32_t fadvise_hint;
398         uint32_t fallocate_mode;
399         uint32_t zero_buffers;
400         uint32_t refill_buffers;
401         uint32_t scramble_buffers;
402         uint8_t buffer_pattern[MAX_PATTERN_SIZE];
403         uint32_t buffer_pattern_bytes;
404         unsigned int compress_percentage;
405         unsigned int compress_chunk;
406         uint32_t time_based;
407         uint32_t disable_lat;
408         uint32_t disable_clat;
409         uint32_t disable_slat;
410         uint32_t disable_bw;
411         uint32_t unified_rw_rep;
412         uint32_t gtod_reduce;
413         uint32_t gtod_cpu;
414         uint32_t gtod_offload;
415         uint32_t clocksource;
416         uint32_t no_stall;
417         uint32_t trim_percentage;
418         uint32_t trim_batch;
419         uint32_t trim_zero;
420         uint64_t trim_backlog;
421         uint32_t clat_percentiles;
422         uint32_t percentile_precision;
423         fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
424
425         uint8_t read_iolog_file[FIO_TOP_STR_MAX];
426         uint8_t write_iolog_file[FIO_TOP_STR_MAX];
427         uint8_t bw_log_file[FIO_TOP_STR_MAX];
428         uint8_t lat_log_file[FIO_TOP_STR_MAX];
429         uint8_t iops_log_file[FIO_TOP_STR_MAX];
430         uint8_t replay_redirect[FIO_TOP_STR_MAX];
431
432         /*
433          * Pre-run and post-run shell
434          */
435         uint8_t exec_prerun[FIO_TOP_STR_MAX];
436         uint8_t exec_postrun[FIO_TOP_STR_MAX];
437
438         uint32_t rate[DDIR_RWDIR_CNT];
439         uint32_t ratemin[DDIR_RWDIR_CNT];
440         uint32_t ratecycle;
441         uint32_t rate_iops[DDIR_RWDIR_CNT];
442         uint32_t rate_iops_min[DDIR_RWDIR_CNT];
443
444         uint8_t ioscheduler[FIO_TOP_STR_MAX];
445
446         /*
447          * I/O Error handling
448          */
449         uint32_t continue_on_error;
450
451         /*
452          * Benchmark profile type
453          */
454         uint8_t profile[FIO_TOP_STR_MAX];
455
456         /*
457          * blkio cgroup support
458          */
459         uint8_t cgroup[FIO_TOP_STR_MAX];
460         uint32_t cgroup_weight;
461         uint32_t cgroup_nodelete;
462
463         uint32_t uid;
464         uint32_t gid;
465
466         int32_t flow_id;
467         int32_t flow;
468         int32_t flow_watermark;
469         uint32_t flow_sleep;
470
471         uint64_t offset_increment;
472         uint64_t number_ios;
473
474         uint32_t sync_file_range;
475
476         uint64_t latency_target;
477         uint64_t latency_window;
478         fio_fp64_t latency_percentile;
479 } __attribute__((packed));
480
481 extern void convert_thread_options_to_cpu(struct thread_options *o, struct thread_options_pack *top);
482 extern void convert_thread_options_to_net(struct thread_options_pack *top, struct thread_options *);
483 extern int fio_test_cconv(struct thread_options *);
484 extern void options_default_fill(struct thread_options *o);
485
486 #endif