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