• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "options.h"
7 #include "stat.h"
8 #include "gettime.h"
9 #include "lib/ieee754.h"
10 #include "lib/pattern.h"
11 #include "td_error.h"
12 
13 /*
14  * What type of allocation to use for io buffers
15  */
16 enum fio_memtype {
17 	MEM_MALLOC = 0,	/* ordinary malloc */
18 	MEM_SHM,	/* use shared memory segments */
19 	MEM_SHMHUGE,	/* use shared memory segments with huge pages */
20 	MEM_MMAP,	/* use anonynomous mmap */
21 	MEM_MMAPHUGE,	/* memory mapped huge file */
22 	MEM_MMAPSHARED, /* use mmap with shared flag */
23 	MEM_CUDA_MALLOC,/* use GPU memory */
24 };
25 
26 #define ERROR_STR_MAX	128
27 
28 #define BSSPLIT_MAX	64
29 #define ZONESPLIT_MAX	64
30 
31 struct bssplit {
32 	uint32_t bs;
33 	uint32_t perc;
34 };
35 
36 struct zone_split {
37 	uint8_t access_perc;
38 	uint8_t size_perc;
39 };
40 
41 #define NR_OPTS_SZ	(FIO_MAX_OPTS / (8 * sizeof(uint64_t)))
42 
43 #define OPT_MAGIC	0x4f50544e
44 
45 struct thread_options {
46 	int magic;
47 	uint64_t set_options[NR_OPTS_SZ];
48 	char *description;
49 	char *name;
50 	char *wait_for;
51 	char *directory;
52 	char *filename;
53 	char *filename_format;
54 	char *opendir;
55 	char *ioengine;
56 	char *mmapfile;
57 	enum td_ddir td_ddir;
58 	unsigned int rw_seq;
59 	unsigned int kb_base;
60 	unsigned int unit_base;
61 	unsigned int ddir_seq_nr;
62 	long long ddir_seq_add;
63 	unsigned int iodepth;
64 	unsigned int iodepth_low;
65 	unsigned int iodepth_batch;
66 	unsigned int iodepth_batch_complete_min;
67 	unsigned int iodepth_batch_complete_max;
68 
69 	unsigned int unique_filename;
70 
71 	unsigned long long size;
72 	unsigned long long io_size;
73 	unsigned int size_percent;
74 	unsigned int fill_device;
75 	unsigned int file_append;
76 	unsigned long long file_size_low;
77 	unsigned long long file_size_high;
78 	unsigned long long start_offset;
79 
80 	unsigned int bs[DDIR_RWDIR_CNT];
81 	unsigned int ba[DDIR_RWDIR_CNT];
82 	unsigned int min_bs[DDIR_RWDIR_CNT];
83 	unsigned int max_bs[DDIR_RWDIR_CNT];
84 	struct bssplit *bssplit[DDIR_RWDIR_CNT];
85 	unsigned int bssplit_nr[DDIR_RWDIR_CNT];
86 
87 	int *ignore_error[ERROR_TYPE_CNT];
88 	unsigned int ignore_error_nr[ERROR_TYPE_CNT];
89 	unsigned int error_dump;
90 
91 	unsigned int nr_files;
92 	unsigned int open_files;
93 	enum file_lock_mode file_lock_mode;
94 
95 	unsigned int odirect;
96 	unsigned int oatomic;
97 	unsigned int invalidate_cache;
98 	unsigned int create_serialize;
99 	unsigned int create_fsync;
100 	unsigned int create_on_open;
101 	unsigned int create_only;
102 	unsigned int end_fsync;
103 	unsigned int pre_read;
104 	unsigned int sync_io;
105 	unsigned int verify;
106 	unsigned int do_verify;
107 	unsigned int verifysort;
108 	unsigned int verifysort_nr;
109 	unsigned int verify_interval;
110 	unsigned int verify_offset;
111 	char verify_pattern[MAX_PATTERN_SIZE];
112 	unsigned int verify_pattern_bytes;
113 	struct pattern_fmt verify_fmt[8];
114 	unsigned int verify_fmt_sz;
115 	unsigned int verify_fatal;
116 	unsigned int verify_dump;
117 	unsigned int verify_async;
118 	unsigned long long verify_backlog;
119 	unsigned int verify_batch;
120 	unsigned int experimental_verify;
121 	unsigned int verify_state;
122 	unsigned int verify_state_save;
123 	unsigned int use_thread;
124 	unsigned int unlink;
125 	unsigned int unlink_each_loop;
126 	unsigned int do_disk_util;
127 	unsigned int override_sync;
128 	unsigned int rand_repeatable;
129 	unsigned int allrand_repeatable;
130 	unsigned long long rand_seed;
131 	unsigned int dep_use_os_rand;
132 	unsigned int log_avg_msec;
133 	unsigned int log_hist_msec;
134 	unsigned int log_hist_coarseness;
135 	unsigned int log_max;
136 	unsigned int log_offset;
137 	unsigned int log_gz;
138 	unsigned int log_gz_store;
139 	unsigned int log_unix_epoch;
140 	unsigned int norandommap;
141 	unsigned int softrandommap;
142 	unsigned int bs_unaligned;
143 	unsigned int fsync_on_close;
144 	unsigned int bs_is_seq_rand;
145 
146 	unsigned int verify_only;
147 
148 	unsigned int random_distribution;
149 	unsigned int exitall_error;
150 
151 	struct zone_split *zone_split[DDIR_RWDIR_CNT];
152 	unsigned int zone_split_nr[DDIR_RWDIR_CNT];
153 
154 	fio_fp64_t zipf_theta;
155 	fio_fp64_t pareto_h;
156 	fio_fp64_t gauss_dev;
157 
158 	unsigned int random_generator;
159 
160 	unsigned int perc_rand[DDIR_RWDIR_CNT];
161 
162 	unsigned int hugepage_size;
163 	unsigned int rw_min_bs;
164 	unsigned int thinktime;
165 	unsigned int thinktime_spin;
166 	unsigned int thinktime_blocks;
167 	unsigned int fsync_blocks;
168 	unsigned int fdatasync_blocks;
169 	unsigned int barrier_blocks;
170 	unsigned long long start_delay;
171 	unsigned long long start_delay_high;
172 	unsigned long long timeout;
173 	unsigned long long ramp_time;
174 	unsigned int ss_state;
175 	fio_fp64_t ss_limit;
176 	unsigned long long ss_dur;
177 	unsigned long long ss_ramp_time;
178 	unsigned int overwrite;
179 	unsigned int bw_avg_time;
180 	unsigned int iops_avg_time;
181 	unsigned int loops;
182 	unsigned long long zone_range;
183 	unsigned long long zone_size;
184 	unsigned long long zone_skip;
185 	unsigned long long lockmem;
186 	enum fio_memtype mem_type;
187 	unsigned int mem_align;
188 
189 	unsigned int max_latency;
190 
191 	unsigned int stonewall;
192 	unsigned int new_group;
193 	unsigned int numjobs;
194 	os_cpu_mask_t cpumask;
195 	os_cpu_mask_t verify_cpumask;
196 	os_cpu_mask_t log_gz_cpumask;
197 	unsigned int cpus_allowed_policy;
198 	char *numa_cpunodes;
199 	unsigned short numa_mem_mode;
200 	unsigned int numa_mem_prefer_node;
201 	char *numa_memnodes;
202 	unsigned int gpu_dev_id;
203 
204 	unsigned int iolog;
205 	unsigned int rwmixcycle;
206 	unsigned int rwmix[DDIR_RWDIR_CNT];
207 	unsigned int nice;
208 	unsigned int ioprio;
209 	unsigned int ioprio_class;
210 	unsigned int file_service_type;
211 	unsigned int group_reporting;
212 	unsigned int stats;
213 	unsigned int fadvise_hint;
214 	unsigned int fadvise_stream;
215 	enum fio_fallocate_mode fallocate_mode;
216 	unsigned int zero_buffers;
217 	unsigned int refill_buffers;
218 	unsigned int scramble_buffers;
219 	char buffer_pattern[MAX_PATTERN_SIZE];
220 	unsigned int buffer_pattern_bytes;
221 	unsigned int compress_percentage;
222 	unsigned int compress_chunk;
223 	unsigned int dedupe_percentage;
224 	unsigned int time_based;
225 	unsigned int disable_lat;
226 	unsigned int disable_clat;
227 	unsigned int disable_slat;
228 	unsigned int disable_bw;
229 	unsigned int unified_rw_rep;
230 	unsigned int gtod_reduce;
231 	unsigned int gtod_cpu;
232 	enum fio_cs clocksource;
233 	unsigned int no_stall;
234 	unsigned int trim_percentage;
235 	unsigned int trim_batch;
236 	unsigned int trim_zero;
237 	unsigned long long trim_backlog;
238 	unsigned int clat_percentiles;
239 	unsigned int percentile_precision;	/* digits after decimal for percentiles */
240 	fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
241 
242 	char *read_iolog_file;
243 	char *write_iolog_file;
244 
245 	unsigned int write_bw_log;
246 	unsigned int write_lat_log;
247 	unsigned int write_iops_log;
248 	unsigned int write_hist_log;
249 
250 	char *bw_log_file;
251 	char *lat_log_file;
252 	char *iops_log_file;
253 	char *hist_log_file;
254 	char *replay_redirect;
255 
256 	/*
257 	 * Pre-run and post-run shell
258 	 */
259 	char *exec_prerun;
260 	char *exec_postrun;
261 
262 	uint64_t rate[DDIR_RWDIR_CNT];
263 	uint64_t ratemin[DDIR_RWDIR_CNT];
264 	unsigned int ratecycle;
265 	unsigned int io_submit_mode;
266 	unsigned int rate_iops[DDIR_RWDIR_CNT];
267 	unsigned int rate_iops_min[DDIR_RWDIR_CNT];
268 	unsigned int rate_process;
269 
270 	char *ioscheduler;
271 
272 	/*
273 	 * I/O Error handling
274 	 */
275 	enum error_type continue_on_error;
276 
277 	/*
278 	 * Benchmark profile type
279 	 */
280 	char *profile;
281 
282 	/*
283 	 * blkio cgroup support
284 	 */
285 	char *cgroup;
286 	unsigned int cgroup_weight;
287 	unsigned int cgroup_nodelete;
288 
289 	unsigned int uid;
290 	unsigned int gid;
291 
292 	int flow_id;
293 	int flow;
294 	int flow_watermark;
295 	unsigned int flow_sleep;
296 
297 	unsigned long long offset_increment;
298 	unsigned long long number_ios;
299 
300 	unsigned int sync_file_range;
301 
302 	unsigned long long latency_target;
303 	unsigned long long latency_window;
304 	fio_fp64_t latency_percentile;
305 
306 	unsigned block_error_hist;
307 	unsigned int skip_bad;
308 
309 	unsigned int replay_align;
310 	unsigned int replay_scale;
311 
312 	unsigned int per_job_logs;
313 
314 	unsigned int allow_create;
315 	unsigned int allow_mounted_write;
316 };
317 
318 #define FIO_TOP_STR_MAX		256
319 
320 struct thread_options_pack {
321 	uint64_t set_options[NR_OPTS_SZ];
322 	uint8_t description[FIO_TOP_STR_MAX];
323 	uint8_t name[FIO_TOP_STR_MAX];
324 	uint8_t wait_for[FIO_TOP_STR_MAX];
325 	uint8_t directory[FIO_TOP_STR_MAX];
326 	uint8_t filename[FIO_TOP_STR_MAX];
327 	uint8_t filename_format[FIO_TOP_STR_MAX];
328 	uint8_t opendir[FIO_TOP_STR_MAX];
329 	uint8_t ioengine[FIO_TOP_STR_MAX];
330 	uint8_t mmapfile[FIO_TOP_STR_MAX];
331 	uint32_t td_ddir;
332 	uint32_t rw_seq;
333 	uint32_t kb_base;
334 	uint32_t unit_base;
335 	uint32_t ddir_seq_nr;
336 	uint64_t ddir_seq_add;
337 	uint32_t iodepth;
338 	uint32_t iodepth_low;
339 	uint32_t iodepth_batch;
340 	uint32_t iodepth_batch_complete_min;
341 	uint32_t iodepth_batch_complete_max;
342 
343 	uint64_t size;
344 	uint64_t io_size;
345 	uint32_t size_percent;
346 	uint32_t fill_device;
347 	uint32_t file_append;
348 	uint32_t unique_filename;
349 	uint64_t file_size_low;
350 	uint64_t file_size_high;
351 	uint64_t start_offset;
352 
353 	uint32_t bs[DDIR_RWDIR_CNT];
354 	uint32_t ba[DDIR_RWDIR_CNT];
355 	uint32_t min_bs[DDIR_RWDIR_CNT];
356 	uint32_t max_bs[DDIR_RWDIR_CNT];
357 	struct bssplit bssplit[DDIR_RWDIR_CNT][BSSPLIT_MAX];
358 	uint32_t bssplit_nr[DDIR_RWDIR_CNT];
359 
360 	uint32_t ignore_error[ERROR_TYPE_CNT][ERROR_STR_MAX];
361 	uint32_t ignore_error_nr[ERROR_TYPE_CNT];
362 	uint32_t error_dump;
363 
364 	uint32_t nr_files;
365 	uint32_t open_files;
366 	uint32_t file_lock_mode;
367 
368 	uint32_t odirect;
369 	uint32_t oatomic;
370 	uint32_t invalidate_cache;
371 	uint32_t create_serialize;
372 	uint32_t create_fsync;
373 	uint32_t create_on_open;
374 	uint32_t create_only;
375 	uint32_t end_fsync;
376 	uint32_t pre_read;
377 	uint32_t sync_io;
378 	uint32_t verify;
379 	uint32_t do_verify;
380 	uint32_t verifysort;
381 	uint32_t verifysort_nr;
382 	uint32_t verify_interval;
383 	uint32_t verify_offset;
384 	uint8_t verify_pattern[MAX_PATTERN_SIZE];
385 	uint32_t verify_pattern_bytes;
386 	uint32_t verify_fatal;
387 	uint32_t verify_dump;
388 	uint32_t verify_async;
389 	uint64_t verify_backlog;
390 	uint32_t verify_batch;
391 	uint32_t experimental_verify;
392 	uint32_t verify_state;
393 	uint32_t verify_state_save;
394 	uint32_t use_thread;
395 	uint32_t unlink;
396 	uint32_t unlink_each_loop;
397 	uint32_t do_disk_util;
398 	uint32_t override_sync;
399 	uint32_t rand_repeatable;
400 	uint32_t allrand_repeatable;
401 	uint64_t rand_seed;
402 	uint32_t dep_use_os_rand;
403 	uint32_t log_avg_msec;
404 	uint32_t log_hist_msec;
405 	uint32_t log_hist_coarseness;
406 	uint32_t log_max;
407 	uint32_t log_offset;
408 	uint32_t log_gz;
409 	uint32_t log_gz_store;
410 	uint32_t log_unix_epoch;
411 	uint32_t norandommap;
412 	uint32_t softrandommap;
413 	uint32_t bs_unaligned;
414 	uint32_t fsync_on_close;
415 	uint32_t bs_is_seq_rand;
416 
417 	uint32_t random_distribution;
418 	uint32_t exitall_error;
419 
420 	struct zone_split zone_split[DDIR_RWDIR_CNT][ZONESPLIT_MAX];
421 	uint32_t zone_split_nr[DDIR_RWDIR_CNT];
422 
423 	fio_fp64_t zipf_theta;
424 	fio_fp64_t pareto_h;
425 	fio_fp64_t gauss_dev;
426 
427 	uint32_t random_generator;
428 
429 	uint32_t perc_rand[DDIR_RWDIR_CNT];
430 
431 	uint32_t hugepage_size;
432 	uint32_t rw_min_bs;
433 	uint32_t thinktime;
434 	uint32_t thinktime_spin;
435 	uint32_t thinktime_blocks;
436 	uint32_t fsync_blocks;
437 	uint32_t fdatasync_blocks;
438 	uint32_t barrier_blocks;
439 	uint64_t start_delay;
440 	uint64_t start_delay_high;
441 	uint64_t timeout;
442 	uint64_t ramp_time;
443 	uint64_t ss_dur;
444 	uint64_t ss_ramp_time;
445 	uint32_t ss_state;
446 	fio_fp64_t ss_limit;
447 	uint32_t overwrite;
448 	uint32_t bw_avg_time;
449 	uint32_t iops_avg_time;
450 	uint32_t loops;
451 	uint64_t zone_range;
452 	uint64_t zone_size;
453 	uint64_t zone_skip;
454 	uint64_t lockmem;
455 	uint32_t mem_type;
456 	uint32_t mem_align;
457 
458 	uint32_t max_latency;
459 
460 	uint32_t stonewall;
461 	uint32_t new_group;
462 	uint32_t numjobs;
463 	/*
464 	 * We currently can't convert these, so don't enable them
465 	 */
466 #if 0
467 	uint8_t cpumask[FIO_TOP_STR_MAX];
468 	uint8_t verify_cpumask[FIO_TOP_STR_MAX];
469 	uint8_t log_gz_cpumask[FIO_TOP_STR_MAX];
470 #endif
471 	uint32_t gpu_dev_id;
472 	uint32_t pad;
473 	uint32_t cpus_allowed_policy;
474 	uint32_t iolog;
475 	uint32_t rwmixcycle;
476 	uint32_t rwmix[DDIR_RWDIR_CNT];
477 	uint32_t nice;
478 	uint32_t ioprio;
479 	uint32_t ioprio_class;
480 	uint32_t file_service_type;
481 	uint32_t group_reporting;
482 	uint32_t stats;
483 	uint32_t fadvise_hint;
484 	uint32_t fadvise_stream;
485 	uint32_t fallocate_mode;
486 	uint32_t zero_buffers;
487 	uint32_t refill_buffers;
488 	uint32_t scramble_buffers;
489 	uint8_t buffer_pattern[MAX_PATTERN_SIZE];
490 	uint32_t buffer_pattern_bytes;
491 	uint32_t compress_percentage;
492 	uint32_t compress_chunk;
493 	uint32_t dedupe_percentage;
494 	uint32_t time_based;
495 	uint32_t disable_lat;
496 	uint32_t disable_clat;
497 	uint32_t disable_slat;
498 	uint32_t disable_bw;
499 	uint32_t unified_rw_rep;
500 	uint32_t gtod_reduce;
501 	uint32_t gtod_cpu;
502 	uint32_t clocksource;
503 	uint32_t no_stall;
504 	uint32_t trim_percentage;
505 	uint32_t trim_batch;
506 	uint32_t trim_zero;
507 	uint64_t trim_backlog;
508 	uint32_t clat_percentiles;
509 	uint32_t percentile_precision;
510 	fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
511 
512 	uint8_t read_iolog_file[FIO_TOP_STR_MAX];
513 	uint8_t write_iolog_file[FIO_TOP_STR_MAX];
514 
515 	uint32_t write_bw_log;
516 	uint32_t write_lat_log;
517 	uint32_t write_iops_log;
518 	uint32_t write_hist_log;
519 
520 	uint8_t bw_log_file[FIO_TOP_STR_MAX];
521 	uint8_t lat_log_file[FIO_TOP_STR_MAX];
522 	uint8_t iops_log_file[FIO_TOP_STR_MAX];
523 	uint8_t hist_log_file[FIO_TOP_STR_MAX];
524 	uint8_t replay_redirect[FIO_TOP_STR_MAX];
525 
526 	/*
527 	 * Pre-run and post-run shell
528 	 */
529 	uint8_t exec_prerun[FIO_TOP_STR_MAX];
530 	uint8_t exec_postrun[FIO_TOP_STR_MAX];
531 
532 	uint64_t rate[DDIR_RWDIR_CNT];
533 	uint64_t ratemin[DDIR_RWDIR_CNT];
534 	uint32_t ratecycle;
535 	uint32_t io_submit_mode;
536 	uint32_t rate_iops[DDIR_RWDIR_CNT];
537 	uint32_t rate_iops_min[DDIR_RWDIR_CNT];
538 	uint32_t rate_process;
539 
540 	uint8_t ioscheduler[FIO_TOP_STR_MAX];
541 
542 	/*
543 	 * I/O Error handling
544 	 */
545 	uint32_t continue_on_error;
546 
547 	/*
548 	 * Benchmark profile type
549 	 */
550 	uint8_t profile[FIO_TOP_STR_MAX];
551 
552 	/*
553 	 * blkio cgroup support
554 	 */
555 	uint8_t cgroup[FIO_TOP_STR_MAX];
556 	uint32_t cgroup_weight;
557 	uint32_t cgroup_nodelete;
558 
559 	uint32_t uid;
560 	uint32_t gid;
561 
562 	int32_t flow_id;
563 	int32_t flow;
564 	int32_t flow_watermark;
565 	uint32_t flow_sleep;
566 
567 	uint64_t offset_increment;
568 	uint64_t number_ios;
569 
570 	uint32_t sync_file_range;
571 	uint32_t pad2;
572 
573 	uint64_t latency_target;
574 	uint64_t latency_window;
575 	fio_fp64_t latency_percentile;
576 
577 	uint32_t block_error_hist;
578 	uint32_t skip_bad;
579 
580 	uint32_t replay_align;
581 	uint32_t replay_scale;
582 
583 	uint32_t per_job_logs;
584 
585 	uint32_t allow_create;
586 	uint32_t allow_mounted_write;
587 } __attribute__((packed));
588 
589 extern void convert_thread_options_to_cpu(struct thread_options *o, struct thread_options_pack *top);
590 extern void convert_thread_options_to_net(struct thread_options_pack *top, struct thread_options *);
591 extern int fio_test_cconv(struct thread_options *);
592 extern void options_default_fill(struct thread_options *o);
593 
594 #endif
595