Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | #include <unistd.h> |
| 4 | #include <ctype.h> |
| 5 | #include <string.h> |
| 6 | #include <getopt.h> |
| 7 | #include <assert.h> |
| 8 | |
| 9 | #include "fio.h" |
| 10 | #include "parse.h" |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 11 | #include "fls.h" |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 12 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 13 | #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 14 | |
| 15 | /* |
| 16 | * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that. |
| 17 | */ |
| 18 | static char *get_opt_postfix(const char *str) |
| 19 | { |
| 20 | char *p = strstr(str, ":"); |
| 21 | |
| 22 | if (!p) |
| 23 | return NULL; |
| 24 | |
| 25 | p++; |
| 26 | strip_blank_front(&p); |
| 27 | strip_blank_end(p); |
| 28 | return strdup(p); |
| 29 | } |
| 30 | |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 31 | static int str_rw_cb(void *data, const char *str) |
| 32 | { |
| 33 | struct thread_data *td = data; |
| 34 | char *nr = get_opt_postfix(str); |
| 35 | |
Jens Axboe | fafdba3 | 2007-03-26 10:09:12 +0200 | [diff] [blame] | 36 | td->o.ddir_nr = 1; |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 37 | if (nr) |
| 38 | td->o.ddir_nr = atoi(nr); |
| 39 | |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 40 | return 0; |
| 41 | } |
| 42 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 43 | static int str_mem_cb(void *data, const char *mem) |
| 44 | { |
| 45 | struct thread_data *td = data; |
| 46 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 47 | if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 48 | td->mmapfile = get_opt_postfix(mem); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 49 | if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 50 | log_err("fio: mmaphuge:/path/to/file\n"); |
| 51 | return 1; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | static int str_lockmem_cb(void fio_unused *data, unsigned long *val) |
| 59 | { |
| 60 | mlock_size = *val; |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | #ifdef FIO_HAVE_IOPRIO |
| 65 | static int str_prioclass_cb(void *data, unsigned int *val) |
| 66 | { |
| 67 | struct thread_data *td = data; |
Jens Axboe | 6cefbe3 | 2007-04-18 12:46:56 +0200 | [diff] [blame] | 68 | unsigned short mask; |
| 69 | |
| 70 | /* |
| 71 | * mask off old class bits, str_prio_cb() may have set a default class |
| 72 | */ |
| 73 | mask = (1 << IOPRIO_CLASS_SHIFT) - 1; |
| 74 | td->ioprio &= mask; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 75 | |
| 76 | td->ioprio |= *val << IOPRIO_CLASS_SHIFT; |
Jens Axboe | ac68478 | 2007-11-08 08:29:07 +0100 | [diff] [blame^] | 77 | td->ioprio_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | static int str_prio_cb(void *data, unsigned int *val) |
| 82 | { |
| 83 | struct thread_data *td = data; |
| 84 | |
| 85 | td->ioprio |= *val; |
Jens Axboe | 6cefbe3 | 2007-04-18 12:46:56 +0200 | [diff] [blame] | 86 | |
| 87 | /* |
| 88 | * If no class is set, assume BE |
| 89 | */ |
| 90 | if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0) |
| 91 | td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT; |
| 92 | |
Jens Axboe | ac68478 | 2007-11-08 08:29:07 +0100 | [diff] [blame^] | 93 | td->ioprio_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 94 | return 0; |
| 95 | } |
| 96 | #endif |
| 97 | |
| 98 | static int str_exitall_cb(void) |
| 99 | { |
| 100 | exitall_on_terminate = 1; |
| 101 | return 0; |
| 102 | } |
| 103 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 104 | #ifdef FIO_HAVE_CPU_AFFINITY |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 105 | static int str_cpumask_cb(void *data, unsigned int *val) |
| 106 | { |
| 107 | struct thread_data *td = data; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 108 | unsigned int i; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 109 | |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 110 | CPU_ZERO(&td->o.cpumask); |
| 111 | |
| 112 | for (i = 0; i < sizeof(int) * 8; i++) |
| 113 | if ((1 << i) & *val) |
| 114 | CPU_SET(*val, &td->o.cpumask); |
| 115 | |
Jens Axboe | 375b269 | 2007-05-22 09:13:02 +0200 | [diff] [blame] | 116 | td->o.cpumask_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 117 | return 0; |
| 118 | } |
| 119 | |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 120 | static int str_cpus_allowed_cb(void *data, const char *input) |
| 121 | { |
| 122 | struct thread_data *td = data; |
| 123 | char *cpu, *str, *p; |
| 124 | |
| 125 | CPU_ZERO(&td->o.cpumask); |
| 126 | |
| 127 | p = str = strdup(input); |
| 128 | |
| 129 | strip_blank_front(&str); |
| 130 | strip_blank_end(str); |
| 131 | |
| 132 | while ((cpu = strsep(&str, ",")) != NULL) { |
| 133 | if (!strlen(cpu)) |
| 134 | break; |
| 135 | CPU_SET(atoi(cpu), &td->o.cpumask); |
| 136 | } |
| 137 | |
| 138 | free(p); |
| 139 | td->o.cpumask_set = 1; |
| 140 | exit(0); |
| 141 | return 0; |
| 142 | } |
| 143 | #endif |
| 144 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 145 | static int str_fst_cb(void *data, const char *str) |
| 146 | { |
| 147 | struct thread_data *td = data; |
| 148 | char *nr = get_opt_postfix(str); |
| 149 | |
| 150 | td->file_service_nr = 1; |
| 151 | if (nr) |
| 152 | td->file_service_nr = atoi(nr); |
| 153 | |
| 154 | return 0; |
| 155 | } |
| 156 | |
| 157 | static int str_filename_cb(void *data, const char *input) |
| 158 | { |
| 159 | struct thread_data *td = data; |
| 160 | char *fname, *str, *p; |
| 161 | |
| 162 | p = str = strdup(input); |
| 163 | |
| 164 | strip_blank_front(&str); |
| 165 | strip_blank_end(str); |
| 166 | |
| 167 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 168 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 169 | |
| 170 | while ((fname = strsep(&str, ":")) != NULL) { |
| 171 | if (!strlen(fname)) |
| 172 | break; |
| 173 | add_file(td, fname); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 174 | td->o.nr_files++; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | free(p); |
| 178 | return 0; |
| 179 | } |
| 180 | |
| 181 | static int str_directory_cb(void *data, const char fio_unused *str) |
| 182 | { |
| 183 | struct thread_data *td = data; |
| 184 | struct stat sb; |
| 185 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 186 | if (lstat(td->o.directory, &sb) < 0) { |
| 187 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 188 | td_verror(td, errno, "lstat"); |
| 189 | return 1; |
| 190 | } |
| 191 | if (!S_ISDIR(sb.st_mode)) { |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 192 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 193 | return 1; |
| 194 | } |
| 195 | |
| 196 | return 0; |
| 197 | } |
| 198 | |
| 199 | static int str_opendir_cb(void *data, const char fio_unused *str) |
| 200 | { |
| 201 | struct thread_data *td = data; |
| 202 | |
| 203 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 204 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 205 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 206 | return add_dir_files(td, td->o.opendir); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 207 | } |
| 208 | |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 209 | static int str_verify_offset_cb(void *data, unsigned int *off) |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 210 | { |
| 211 | struct thread_data *td = data; |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 212 | |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 213 | if (*off && *off < sizeof(struct verify_header)) { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 214 | log_err("fio: verify_offset too small\n"); |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 215 | return 1; |
| 216 | } |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 217 | |
| 218 | td->o.verify_offset = *off; |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 219 | return 0; |
| 220 | } |
| 221 | |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 222 | static int str_verify_cb(void *data, const char *mem) |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 223 | { |
| 224 | struct thread_data *td = data; |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 225 | unsigned int nr, msb; |
| 226 | char *pat; |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 227 | |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 228 | if (td->o.verify != VERIFY_PATTERN) |
| 229 | return 0; |
| 230 | |
| 231 | pat = get_opt_postfix(mem); |
| 232 | if (!pat) { |
| 233 | log_err("fio: missing pattern\n"); |
| 234 | return 1; |
| 235 | } |
| 236 | |
| 237 | if (strstr(pat, "0x") || strstr(pat, "0X")) |
| 238 | nr = strtol(pat, NULL, 16); |
| 239 | else |
| 240 | nr = strtol(pat, NULL, 16); |
| 241 | |
| 242 | msb = fls(nr); |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 243 | if (msb <= 8) |
| 244 | td->o.verify_pattern_bytes = 1; |
| 245 | else if (msb <= 16) |
| 246 | td->o.verify_pattern_bytes = 2; |
| 247 | else if (msb <= 24) |
| 248 | td->o.verify_pattern_bytes = 3; |
| 249 | else |
| 250 | td->o.verify_pattern_bytes = 4; |
| 251 | |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 252 | td->o.verify_pattern = nr; |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 253 | return 0; |
| 254 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 255 | |
| 256 | #define __stringify_1(x) #x |
| 257 | #define __stringify(x) __stringify_1(x) |
| 258 | |
| 259 | /* |
| 260 | * Map of job/command line options |
| 261 | */ |
| 262 | static struct fio_option options[] = { |
| 263 | { |
| 264 | .name = "description", |
| 265 | .type = FIO_OPT_STR_STORE, |
| 266 | .off1 = td_var_offset(description), |
| 267 | .help = "Text job description", |
| 268 | }, |
| 269 | { |
| 270 | .name = "name", |
| 271 | .type = FIO_OPT_STR_STORE, |
| 272 | .off1 = td_var_offset(name), |
| 273 | .help = "Name of this job", |
| 274 | }, |
| 275 | { |
| 276 | .name = "directory", |
| 277 | .type = FIO_OPT_STR_STORE, |
| 278 | .off1 = td_var_offset(directory), |
| 279 | .cb = str_directory_cb, |
| 280 | .help = "Directory to store files in", |
| 281 | }, |
| 282 | { |
| 283 | .name = "filename", |
| 284 | .type = FIO_OPT_STR_STORE, |
| 285 | .off1 = td_var_offset(filename), |
| 286 | .cb = str_filename_cb, |
| 287 | .help = "File(s) to use for the workload", |
| 288 | }, |
| 289 | { |
| 290 | .name = "opendir", |
| 291 | .type = FIO_OPT_STR_STORE, |
| 292 | .off1 = td_var_offset(opendir), |
| 293 | .cb = str_opendir_cb, |
| 294 | .help = "Recursively add files from this directory and down", |
| 295 | }, |
| 296 | { |
| 297 | .name = "rw", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 298 | .alias = "readwrite", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 299 | .type = FIO_OPT_STR, |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 300 | .cb = str_rw_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 301 | .off1 = td_var_offset(td_ddir), |
| 302 | .help = "IO direction", |
| 303 | .def = "read", |
| 304 | .posval = { |
| 305 | { .ival = "read", |
| 306 | .oval = TD_DDIR_READ, |
| 307 | .help = "Sequential read", |
| 308 | }, |
| 309 | { .ival = "write", |
| 310 | .oval = TD_DDIR_WRITE, |
| 311 | .help = "Sequential write", |
| 312 | }, |
| 313 | { .ival = "randread", |
| 314 | .oval = TD_DDIR_RANDREAD, |
| 315 | .help = "Random read", |
| 316 | }, |
| 317 | { .ival = "randwrite", |
| 318 | .oval = TD_DDIR_RANDWRITE, |
| 319 | .help = "Random write", |
| 320 | }, |
| 321 | { .ival = "rw", |
| 322 | .oval = TD_DDIR_RW, |
| 323 | .help = "Sequential read and write mix", |
| 324 | }, |
| 325 | { .ival = "randrw", |
| 326 | .oval = TD_DDIR_RANDRW, |
| 327 | .help = "Random read and write mix" |
| 328 | }, |
| 329 | }, |
| 330 | }, |
| 331 | { |
| 332 | .name = "ioengine", |
| 333 | .type = FIO_OPT_STR_STORE, |
| 334 | .off1 = td_var_offset(ioengine), |
| 335 | .help = "IO engine to use", |
| 336 | .def = "sync", |
| 337 | .posval = { |
| 338 | { .ival = "sync", |
| 339 | .help = "Use read/write", |
| 340 | }, |
gurudas pai | a31041e | 2007-10-23 15:12:30 +0200 | [diff] [blame] | 341 | { .ival = "psync", |
| 342 | .help = "Use pread/pwrite", |
| 343 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 344 | #ifdef FIO_HAVE_LIBAIO |
| 345 | { .ival = "libaio", |
| 346 | .help = "Linux native asynchronous IO", |
| 347 | }, |
| 348 | #endif |
| 349 | #ifdef FIO_HAVE_POSIXAIO |
| 350 | { .ival = "posixaio", |
| 351 | .help = "POSIX asynchronous IO", |
| 352 | }, |
| 353 | #endif |
| 354 | { .ival = "mmap", |
| 355 | .help = "Memory mapped IO", |
| 356 | }, |
| 357 | #ifdef FIO_HAVE_SPLICE |
| 358 | { .ival = "splice", |
| 359 | .help = "splice/vmsplice based IO", |
| 360 | }, |
Jens Axboe | 9cce02e | 2007-06-22 15:42:21 +0200 | [diff] [blame] | 361 | { .ival = "netsplice", |
| 362 | .help = "splice/vmsplice to/from the network", |
| 363 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 364 | #endif |
| 365 | #ifdef FIO_HAVE_SGIO |
| 366 | { .ival = "sg", |
| 367 | .help = "SCSI generic v3 IO", |
| 368 | }, |
| 369 | #endif |
| 370 | { .ival = "null", |
| 371 | .help = "Testing engine (no data transfer)", |
| 372 | }, |
| 373 | { .ival = "net", |
| 374 | .help = "Network IO", |
| 375 | }, |
| 376 | #ifdef FIO_HAVE_SYSLET |
| 377 | { .ival = "syslet-rw", |
| 378 | .help = "syslet enabled async pread/pwrite IO", |
| 379 | }, |
| 380 | #endif |
| 381 | { .ival = "cpuio", |
| 382 | .help = "CPU cycler burner engine", |
| 383 | }, |
Jens Axboe | b8c82a4 | 2007-03-21 08:48:26 +0100 | [diff] [blame] | 384 | #ifdef FIO_HAVE_GUASI |
| 385 | { .ival = "guasi", |
| 386 | .help = "GUASI IO engine", |
| 387 | }, |
| 388 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 389 | { .ival = "external", |
| 390 | .help = "Load external engine (append name)", |
| 391 | }, |
| 392 | }, |
| 393 | }, |
| 394 | { |
| 395 | .name = "iodepth", |
| 396 | .type = FIO_OPT_INT, |
| 397 | .off1 = td_var_offset(iodepth), |
| 398 | .help = "Amount of IO buffers to keep in flight", |
| 399 | .def = "1", |
| 400 | }, |
| 401 | { |
| 402 | .name = "iodepth_batch", |
| 403 | .type = FIO_OPT_INT, |
| 404 | .off1 = td_var_offset(iodepth_batch), |
| 405 | .help = "Number of IO to submit in one go", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 406 | .parent = "iodepth", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 407 | }, |
| 408 | { |
| 409 | .name = "iodepth_low", |
| 410 | .type = FIO_OPT_INT, |
| 411 | .off1 = td_var_offset(iodepth_low), |
| 412 | .help = "Low water mark for queuing depth", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 413 | .parent = "iodepth", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 414 | }, |
| 415 | { |
| 416 | .name = "size", |
| 417 | .type = FIO_OPT_STR_VAL, |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 418 | .off1 = td_var_offset(size), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 419 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 420 | .help = "Total size of device or files", |
| 421 | }, |
| 422 | { |
| 423 | .name = "filesize", |
| 424 | .type = FIO_OPT_STR_VAL, |
| 425 | .off1 = td_var_offset(file_size_low), |
| 426 | .off2 = td_var_offset(file_size_high), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 427 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 428 | .help = "Size of individual files", |
| 429 | }, |
| 430 | { |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 431 | .name = "offset", |
| 432 | .alias = "fileoffset", |
| 433 | .type = FIO_OPT_STR_VAL, |
| 434 | .off1 = td_var_offset(start_offset), |
| 435 | .help = "Start IO from this offset", |
| 436 | .def = "0", |
| 437 | }, |
| 438 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 439 | .name = "bs", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 440 | .alias = "blocksize", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 441 | .type = FIO_OPT_STR_VAL_INT, |
| 442 | .off1 = td_var_offset(bs[DDIR_READ]), |
| 443 | .off2 = td_var_offset(bs[DDIR_WRITE]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 444 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 445 | .help = "Block size unit", |
| 446 | .def = "4k", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 447 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 448 | }, |
| 449 | { |
| 450 | .name = "bsrange", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 451 | .alias = "blocksize_range", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 452 | .type = FIO_OPT_RANGE, |
| 453 | .off1 = td_var_offset(min_bs[DDIR_READ]), |
| 454 | .off2 = td_var_offset(max_bs[DDIR_READ]), |
| 455 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), |
| 456 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 457 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 458 | .help = "Set block size range (in more detail than bs)", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 459 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 460 | }, |
| 461 | { |
| 462 | .name = "bs_unaligned", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 463 | .alias = "blocksize_unaligned", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 464 | .type = FIO_OPT_STR_SET, |
| 465 | .off1 = td_var_offset(bs_unaligned), |
| 466 | .help = "Don't sector align IO buffer sizes", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 467 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 468 | }, |
| 469 | { |
| 470 | .name = "randrepeat", |
| 471 | .type = FIO_OPT_BOOL, |
| 472 | .off1 = td_var_offset(rand_repeatable), |
| 473 | .help = "Use repeatable random IO pattern", |
| 474 | .def = "1", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 475 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 476 | }, |
| 477 | { |
| 478 | .name = "norandommap", |
| 479 | .type = FIO_OPT_STR_SET, |
| 480 | .off1 = td_var_offset(norandommap), |
| 481 | .help = "Accept potential duplicate random blocks", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 482 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 483 | }, |
| 484 | { |
| 485 | .name = "nrfiles", |
| 486 | .type = FIO_OPT_INT, |
| 487 | .off1 = td_var_offset(nr_files), |
| 488 | .help = "Split job workload between this number of files", |
| 489 | .def = "1", |
| 490 | }, |
| 491 | { |
| 492 | .name = "openfiles", |
| 493 | .type = FIO_OPT_INT, |
| 494 | .off1 = td_var_offset(open_files), |
| 495 | .help = "Number of files to keep open at the same time", |
| 496 | }, |
| 497 | { |
| 498 | .name = "file_service_type", |
| 499 | .type = FIO_OPT_STR, |
| 500 | .cb = str_fst_cb, |
| 501 | .off1 = td_var_offset(file_service_type), |
| 502 | .help = "How to select which file to service next", |
| 503 | .def = "roundrobin", |
| 504 | .posval = { |
| 505 | { .ival = "random", |
| 506 | .oval = FIO_FSERVICE_RANDOM, |
| 507 | .help = "Choose a file at random", |
| 508 | }, |
| 509 | { .ival = "roundrobin", |
| 510 | .oval = FIO_FSERVICE_RR, |
| 511 | .help = "Round robin select files", |
| 512 | }, |
| 513 | }, |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 514 | .parent = "nrfiles", |
| 515 | }, |
| 516 | { |
| 517 | .name = "fadvise_hint", |
| 518 | .type = FIO_OPT_BOOL, |
| 519 | .off1 = td_var_offset(fadvise_hint), |
| 520 | .help = "Use fadvise() to advise the kernel on IO pattern", |
| 521 | .def = "1", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 522 | }, |
| 523 | { |
| 524 | .name = "fsync", |
| 525 | .type = FIO_OPT_INT, |
| 526 | .off1 = td_var_offset(fsync_blocks), |
| 527 | .help = "Issue fsync for writes every given number of blocks", |
| 528 | .def = "0", |
| 529 | }, |
| 530 | { |
| 531 | .name = "direct", |
| 532 | .type = FIO_OPT_BOOL, |
| 533 | .off1 = td_var_offset(odirect), |
| 534 | .help = "Use O_DIRECT IO (negates buffered)", |
| 535 | .def = "0", |
| 536 | }, |
| 537 | { |
| 538 | .name = "buffered", |
| 539 | .type = FIO_OPT_BOOL, |
| 540 | .off1 = td_var_offset(odirect), |
| 541 | .neg = 1, |
| 542 | .help = "Use buffered IO (negates direct)", |
| 543 | .def = "1", |
| 544 | }, |
| 545 | { |
| 546 | .name = "overwrite", |
| 547 | .type = FIO_OPT_BOOL, |
| 548 | .off1 = td_var_offset(overwrite), |
| 549 | .help = "When writing, set whether to overwrite current data", |
| 550 | .def = "0", |
| 551 | }, |
| 552 | { |
| 553 | .name = "loops", |
| 554 | .type = FIO_OPT_INT, |
| 555 | .off1 = td_var_offset(loops), |
| 556 | .help = "Number of times to run the job", |
| 557 | .def = "1", |
| 558 | }, |
| 559 | { |
| 560 | .name = "numjobs", |
| 561 | .type = FIO_OPT_INT, |
| 562 | .off1 = td_var_offset(numjobs), |
| 563 | .help = "Duplicate this job this many times", |
| 564 | .def = "1", |
| 565 | }, |
| 566 | { |
| 567 | .name = "startdelay", |
| 568 | .type = FIO_OPT_INT, |
| 569 | .off1 = td_var_offset(start_delay), |
| 570 | .help = "Only start job when this period has passed", |
| 571 | .def = "0", |
| 572 | }, |
| 573 | { |
| 574 | .name = "runtime", |
| 575 | .alias = "timeout", |
| 576 | .type = FIO_OPT_STR_VAL_TIME, |
| 577 | .off1 = td_var_offset(timeout), |
| 578 | .help = "Stop workload when this amount of time has passed", |
| 579 | .def = "0", |
| 580 | }, |
| 581 | { |
Jens Axboe | cf4464c | 2007-04-17 20:14:42 +0200 | [diff] [blame] | 582 | .name = "time_based", |
| 583 | .type = FIO_OPT_STR_SET, |
| 584 | .off1 = td_var_offset(time_based), |
| 585 | .help = "Keep running until runtime/timeout is met", |
| 586 | }, |
| 587 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 588 | .name = "mem", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 589 | .alias = "iomem", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 590 | .type = FIO_OPT_STR, |
| 591 | .cb = str_mem_cb, |
| 592 | .off1 = td_var_offset(mem_type), |
| 593 | .help = "Backing type for IO buffers", |
| 594 | .def = "malloc", |
| 595 | .posval = { |
| 596 | { .ival = "malloc", |
| 597 | .oval = MEM_MALLOC, |
| 598 | .help = "Use malloc(3) for IO buffers", |
| 599 | }, |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 600 | { .ival = "shm", |
| 601 | .oval = MEM_SHM, |
| 602 | .help = "Use shared memory segments for IO buffers", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 603 | }, |
| 604 | #ifdef FIO_HAVE_HUGETLB |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 605 | { .ival = "shmhuge", |
| 606 | .oval = MEM_SHMHUGE, |
| 607 | .help = "Like shm, but use huge pages", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 608 | }, |
| 609 | #endif |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 610 | { .ival = "mmap", |
| 611 | .oval = MEM_MMAP, |
| 612 | .help = "Use mmap(2) (file or anon) for IO buffers", |
| 613 | }, |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 614 | #ifdef FIO_HAVE_HUGETLB |
| 615 | { .ival = "mmaphuge", |
| 616 | .oval = MEM_MMAPHUGE, |
| 617 | .help = "Like mmap, but use huge pages", |
| 618 | }, |
| 619 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 620 | }, |
| 621 | }, |
| 622 | { |
| 623 | .name = "verify", |
| 624 | .type = FIO_OPT_STR, |
| 625 | .off1 = td_var_offset(verify), |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 626 | .cb = str_verify_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 627 | .help = "Verify data written", |
| 628 | .def = "0", |
| 629 | .posval = { |
| 630 | { .ival = "0", |
| 631 | .oval = VERIFY_NONE, |
| 632 | .help = "Don't do IO verification", |
| 633 | }, |
Jens Axboe | fcca4b5 | 2007-07-27 15:42:00 +0200 | [diff] [blame] | 634 | { .ival = "md5", |
| 635 | .oval = VERIFY_MD5, |
| 636 | .help = "Use md5 checksums for verification", |
| 637 | }, |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 638 | { .ival = "crc64", |
| 639 | .oval = VERIFY_CRC64, |
| 640 | .help = "Use crc64 checksums for verification", |
| 641 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 642 | { .ival = "crc32", |
| 643 | .oval = VERIFY_CRC32, |
| 644 | .help = "Use crc32 checksums for verification", |
| 645 | }, |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 646 | { .ival = "crc16", |
| 647 | .oval = VERIFY_CRC16, |
| 648 | .help = "Use crc16 checksums for verification", |
| 649 | }, |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 650 | { .ival = "crc7", |
| 651 | .oval = VERIFY_CRC7, |
| 652 | .help = "Use crc7 checksums for verification", |
| 653 | }, |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 654 | { .ival = "sha256", |
| 655 | .oval = VERIFY_SHA256, |
| 656 | .help = "Use sha256 checksums for verification", |
| 657 | }, |
| 658 | { .ival = "sha512", |
| 659 | .oval = VERIFY_SHA512, |
| 660 | .help = "Use sha512 checksums for verification", |
| 661 | }, |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 662 | { .ival = "meta", |
| 663 | .oval = VERIFY_META, |
| 664 | .help = "Use io information", |
| 665 | }, |
Jens Axboe | bfb41d9 | 2007-08-10 13:56:08 +0200 | [diff] [blame] | 666 | { .ival = "pattern", |
| 667 | .oval = VERIFY_PATTERN, |
| 668 | .help = "Verify a specific buffer pattern", |
| 669 | }, |
Jens Axboe | 36690c9 | 2007-03-26 10:23:34 +0200 | [diff] [blame] | 670 | { |
| 671 | .ival = "null", |
| 672 | .oval = VERIFY_NULL, |
| 673 | .help = "Pretend to verify", |
| 674 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 675 | }, |
| 676 | }, |
| 677 | { |
Jens Axboe | 005c565 | 2007-08-02 22:21:36 +0200 | [diff] [blame] | 678 | .name = "do_verify", |
Jens Axboe | 68e1f29 | 2007-08-10 10:32:14 +0200 | [diff] [blame] | 679 | .type = FIO_OPT_BOOL, |
Jens Axboe | 005c565 | 2007-08-02 22:21:36 +0200 | [diff] [blame] | 680 | .off1 = td_var_offset(do_verify), |
| 681 | .help = "Run verification stage after write", |
| 682 | .def = "1", |
| 683 | .parent = "verify", |
| 684 | }, |
| 685 | { |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 686 | .name = "verifysort", |
| 687 | .type = FIO_OPT_BOOL, |
| 688 | .off1 = td_var_offset(verifysort), |
| 689 | .help = "Sort written verify blocks for read back", |
| 690 | .def = "1", |
Jens Axboe | c83f2df | 2007-07-31 22:51:47 +0200 | [diff] [blame] | 691 | .parent = "verify", |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 692 | }, |
| 693 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 694 | .name = "verify_interval", |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 695 | .type = FIO_OPT_STR_VAL_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 696 | .off1 = td_var_offset(verify_interval), |
Jens Axboe | 819a968 | 2007-07-28 21:30:31 +0200 | [diff] [blame] | 697 | .minval = 2 * sizeof(struct verify_header), |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 698 | .help = "Store verify buffer header every N bytes", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 699 | .parent = "verify", |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 700 | }, |
| 701 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 702 | .name = "verify_offset", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 703 | .type = FIO_OPT_STR_VAL_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 704 | .help = "Offset verify header location by N bytes", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 705 | .def = "0", |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 706 | .cb = str_verify_offset_cb, |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 707 | .parent = "verify", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 708 | }, |
| 709 | { |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 710 | .name = "verify_fatal", |
Jens Axboe | 68e1f29 | 2007-08-10 10:32:14 +0200 | [diff] [blame] | 711 | .type = FIO_OPT_BOOL, |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 712 | .off1 = td_var_offset(verify_fatal), |
| 713 | .def = "0", |
| 714 | .help = "Exit on a single verify failure, don't continue", |
| 715 | .parent = "verify", |
| 716 | }, |
| 717 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 718 | .name = "write_iolog", |
| 719 | .type = FIO_OPT_STR_STORE, |
| 720 | .off1 = td_var_offset(write_iolog_file), |
| 721 | .help = "Store IO pattern to file", |
| 722 | }, |
| 723 | { |
| 724 | .name = "read_iolog", |
| 725 | .type = FIO_OPT_STR_STORE, |
| 726 | .off1 = td_var_offset(read_iolog_file), |
| 727 | .help = "Playback IO pattern from file", |
| 728 | }, |
| 729 | { |
| 730 | .name = "exec_prerun", |
| 731 | .type = FIO_OPT_STR_STORE, |
| 732 | .off1 = td_var_offset(exec_prerun), |
| 733 | .help = "Execute this file prior to running job", |
| 734 | }, |
| 735 | { |
| 736 | .name = "exec_postrun", |
| 737 | .type = FIO_OPT_STR_STORE, |
| 738 | .off1 = td_var_offset(exec_postrun), |
| 739 | .help = "Execute this file after running job", |
| 740 | }, |
| 741 | #ifdef FIO_HAVE_IOSCHED_SWITCH |
| 742 | { |
| 743 | .name = "ioscheduler", |
| 744 | .type = FIO_OPT_STR_STORE, |
| 745 | .off1 = td_var_offset(ioscheduler), |
| 746 | .help = "Use this IO scheduler on the backing device", |
| 747 | }, |
| 748 | #endif |
| 749 | { |
| 750 | .name = "zonesize", |
| 751 | .type = FIO_OPT_STR_VAL, |
| 752 | .off1 = td_var_offset(zone_size), |
| 753 | .help = "Give size of an IO zone", |
| 754 | .def = "0", |
| 755 | }, |
| 756 | { |
| 757 | .name = "zoneskip", |
| 758 | .type = FIO_OPT_STR_VAL, |
| 759 | .off1 = td_var_offset(zone_skip), |
| 760 | .help = "Space between IO zones", |
| 761 | .def = "0", |
| 762 | }, |
| 763 | { |
| 764 | .name = "lockmem", |
| 765 | .type = FIO_OPT_STR_VAL, |
| 766 | .cb = str_lockmem_cb, |
| 767 | .help = "Lock down this amount of memory", |
| 768 | .def = "0", |
| 769 | }, |
| 770 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 771 | .name = "rwmixread", |
| 772 | .type = FIO_OPT_INT, |
Jens Axboe | e47f799 | 2007-03-21 14:05:39 +0100 | [diff] [blame] | 773 | .off1 = td_var_offset(rwmix[DDIR_READ]), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 774 | .maxval = 100, |
| 775 | .help = "Percentage of mixed workload that is reads", |
| 776 | .def = "50", |
| 777 | }, |
| 778 | { |
| 779 | .name = "rwmixwrite", |
| 780 | .type = FIO_OPT_INT, |
Jens Axboe | e47f799 | 2007-03-21 14:05:39 +0100 | [diff] [blame] | 781 | .off1 = td_var_offset(rwmix[DDIR_WRITE]), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 782 | .maxval = 100, |
| 783 | .help = "Percentage of mixed workload that is writes", |
| 784 | .def = "50", |
| 785 | }, |
| 786 | { |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 787 | .name = "rwmixcycle", |
| 788 | .type = FIO_OPT_INT, |
| 789 | .off1 = td_var_offset(rwmixcycle), |
| 790 | .help = "Cycle period for mixed read/write workloads (msec)", |
| 791 | .def = "500", |
| 792 | .parent = "rwmixread", |
| 793 | }, |
| 794 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 795 | .name = "nice", |
| 796 | .type = FIO_OPT_INT, |
| 797 | .off1 = td_var_offset(nice), |
| 798 | .help = "Set job CPU nice value", |
| 799 | .minval = -19, |
| 800 | .maxval = 20, |
| 801 | .def = "0", |
| 802 | }, |
| 803 | #ifdef FIO_HAVE_IOPRIO |
| 804 | { |
| 805 | .name = "prio", |
| 806 | .type = FIO_OPT_INT, |
| 807 | .cb = str_prio_cb, |
| 808 | .help = "Set job IO priority value", |
| 809 | .minval = 0, |
| 810 | .maxval = 7, |
| 811 | }, |
| 812 | { |
| 813 | .name = "prioclass", |
| 814 | .type = FIO_OPT_INT, |
| 815 | .cb = str_prioclass_cb, |
| 816 | .help = "Set job IO priority class", |
| 817 | .minval = 0, |
| 818 | .maxval = 3, |
| 819 | }, |
| 820 | #endif |
| 821 | { |
| 822 | .name = "thinktime", |
| 823 | .type = FIO_OPT_INT, |
| 824 | .off1 = td_var_offset(thinktime), |
| 825 | .help = "Idle time between IO buffers (usec)", |
| 826 | .def = "0", |
| 827 | }, |
| 828 | { |
| 829 | .name = "thinktime_spin", |
| 830 | .type = FIO_OPT_INT, |
| 831 | .off1 = td_var_offset(thinktime_spin), |
| 832 | .help = "Start think time by spinning this amount (usec)", |
| 833 | .def = "0", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 834 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 835 | }, |
| 836 | { |
| 837 | .name = "thinktime_blocks", |
| 838 | .type = FIO_OPT_INT, |
| 839 | .off1 = td_var_offset(thinktime_blocks), |
| 840 | .help = "IO buffer period between 'thinktime'", |
| 841 | .def = "1", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 842 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 843 | }, |
| 844 | { |
| 845 | .name = "rate", |
| 846 | .type = FIO_OPT_INT, |
| 847 | .off1 = td_var_offset(rate), |
| 848 | .help = "Set bandwidth rate", |
| 849 | }, |
| 850 | { |
| 851 | .name = "ratemin", |
| 852 | .type = FIO_OPT_INT, |
| 853 | .off1 = td_var_offset(ratemin), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 854 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 855 | .parent = "rate", |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 856 | }, |
| 857 | { |
| 858 | .name = "rate_iops", |
| 859 | .type = FIO_OPT_INT, |
| 860 | .off1 = td_var_offset(rate_iops), |
| 861 | .help = "Limit IO used to this number of IO operations/sec", |
| 862 | }, |
| 863 | { |
| 864 | .name = "rate_iops_min", |
| 865 | .type = FIO_OPT_INT, |
| 866 | .off1 = td_var_offset(rate_iops_min), |
| 867 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 868 | .parent = "rate_iops", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 869 | }, |
| 870 | { |
| 871 | .name = "ratecycle", |
| 872 | .type = FIO_OPT_INT, |
| 873 | .off1 = td_var_offset(ratecycle), |
| 874 | .help = "Window average for rate limits (msec)", |
| 875 | .def = "1000", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 876 | .parent = "rate", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 877 | }, |
| 878 | { |
| 879 | .name = "invalidate", |
| 880 | .type = FIO_OPT_BOOL, |
| 881 | .off1 = td_var_offset(invalidate_cache), |
| 882 | .help = "Invalidate buffer/page cache prior to running job", |
| 883 | .def = "1", |
| 884 | }, |
| 885 | { |
| 886 | .name = "sync", |
| 887 | .type = FIO_OPT_BOOL, |
| 888 | .off1 = td_var_offset(sync_io), |
| 889 | .help = "Use O_SYNC for buffered writes", |
| 890 | .def = "0", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 891 | .parent = "buffered", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 892 | }, |
| 893 | { |
| 894 | .name = "bwavgtime", |
| 895 | .type = FIO_OPT_INT, |
| 896 | .off1 = td_var_offset(bw_avg_time), |
| 897 | .help = "Time window over which to calculate bandwidth (msec)", |
| 898 | .def = "500", |
| 899 | }, |
| 900 | { |
| 901 | .name = "create_serialize", |
| 902 | .type = FIO_OPT_BOOL, |
| 903 | .off1 = td_var_offset(create_serialize), |
| 904 | .help = "Serialize creating of job files", |
| 905 | .def = "1", |
| 906 | }, |
| 907 | { |
| 908 | .name = "create_fsync", |
| 909 | .type = FIO_OPT_BOOL, |
| 910 | .off1 = td_var_offset(create_fsync), |
| 911 | .help = "Fsync file after creation", |
| 912 | .def = "1", |
| 913 | }, |
| 914 | { |
| 915 | .name = "cpuload", |
| 916 | .type = FIO_OPT_INT, |
| 917 | .off1 = td_var_offset(cpuload), |
| 918 | .help = "Use this percentage of CPU", |
| 919 | }, |
| 920 | { |
| 921 | .name = "cpuchunks", |
| 922 | .type = FIO_OPT_INT, |
| 923 | .off1 = td_var_offset(cpucycle), |
| 924 | .help = "Length of the CPU burn cycles (usecs)", |
| 925 | .def = "50000", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 926 | .parent = "cpuload", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 927 | }, |
| 928 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 929 | { |
| 930 | .name = "cpumask", |
| 931 | .type = FIO_OPT_INT, |
| 932 | .cb = str_cpumask_cb, |
| 933 | .help = "CPU affinity mask", |
| 934 | }, |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 935 | { |
| 936 | .name = "cpus_allowed", |
| 937 | .type = FIO_OPT_STR, |
| 938 | .cb = str_cpus_allowed_cb, |
| 939 | .help = "Set CPUs allowed", |
| 940 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 941 | #endif |
| 942 | { |
| 943 | .name = "end_fsync", |
| 944 | .type = FIO_OPT_BOOL, |
| 945 | .off1 = td_var_offset(end_fsync), |
| 946 | .help = "Include fsync at the end of job", |
| 947 | .def = "0", |
| 948 | }, |
| 949 | { |
| 950 | .name = "fsync_on_close", |
| 951 | .type = FIO_OPT_BOOL, |
| 952 | .off1 = td_var_offset(fsync_on_close), |
| 953 | .help = "fsync files on close", |
| 954 | .def = "0", |
| 955 | }, |
| 956 | { |
| 957 | .name = "unlink", |
| 958 | .type = FIO_OPT_BOOL, |
| 959 | .off1 = td_var_offset(unlink), |
| 960 | .help = "Unlink created files after job has completed", |
| 961 | .def = "0", |
| 962 | }, |
| 963 | { |
| 964 | .name = "exitall", |
| 965 | .type = FIO_OPT_STR_SET, |
| 966 | .cb = str_exitall_cb, |
| 967 | .help = "Terminate all jobs when one exits", |
| 968 | }, |
| 969 | { |
| 970 | .name = "stonewall", |
| 971 | .type = FIO_OPT_STR_SET, |
| 972 | .off1 = td_var_offset(stonewall), |
| 973 | .help = "Insert a hard barrier between this job and previous", |
| 974 | }, |
| 975 | { |
Jens Axboe | b3d62a7 | 2007-03-20 14:23:26 +0100 | [diff] [blame] | 976 | .name = "new_group", |
| 977 | .type = FIO_OPT_STR_SET, |
| 978 | .off1 = td_var_offset(new_group), |
| 979 | .help = "Mark the start of a new group (for reporting)", |
| 980 | }, |
| 981 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 982 | .name = "thread", |
| 983 | .type = FIO_OPT_STR_SET, |
| 984 | .off1 = td_var_offset(use_thread), |
| 985 | .help = "Use threads instead of forks", |
| 986 | }, |
| 987 | { |
| 988 | .name = "write_bw_log", |
| 989 | .type = FIO_OPT_STR_SET, |
| 990 | .off1 = td_var_offset(write_bw_log), |
| 991 | .help = "Write log of bandwidth during run", |
| 992 | }, |
| 993 | { |
| 994 | .name = "write_lat_log", |
| 995 | .type = FIO_OPT_STR_SET, |
| 996 | .off1 = td_var_offset(write_lat_log), |
| 997 | .help = "Write log of latency during run", |
| 998 | }, |
| 999 | { |
| 1000 | .name = "hugepage-size", |
| 1001 | .type = FIO_OPT_STR_VAL, |
| 1002 | .off1 = td_var_offset(hugepage_size), |
| 1003 | .help = "When using hugepages, specify size of each page", |
| 1004 | .def = __stringify(FIO_HUGE_PAGE), |
| 1005 | }, |
| 1006 | { |
| 1007 | .name = "group_reporting", |
| 1008 | .type = FIO_OPT_STR_SET, |
| 1009 | .off1 = td_var_offset(group_reporting), |
| 1010 | .help = "Do reporting on a per-group basis", |
| 1011 | }, |
| 1012 | { |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 1013 | .name = "zero_buffers", |
| 1014 | .type = FIO_OPT_STR_SET, |
| 1015 | .off1 = td_var_offset(zero_buffers), |
| 1016 | .help = "Init IO buffers to all zeroes", |
| 1017 | }, |
Jens Axboe | 0a839f3 | 2007-04-26 09:02:34 +0200 | [diff] [blame] | 1018 | #ifdef FIO_HAVE_DISK_UTIL |
| 1019 | { |
| 1020 | .name = "disk_util", |
| 1021 | .type = FIO_OPT_BOOL, |
| 1022 | .off1 = td_var_offset(do_disk_util), |
| 1023 | .help = "Log disk utilization stats", |
| 1024 | .def = "1", |
| 1025 | }, |
| 1026 | #endif |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 1027 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1028 | .name = NULL, |
| 1029 | }, |
| 1030 | }; |
| 1031 | |
| 1032 | void fio_options_dup_and_init(struct option *long_options) |
| 1033 | { |
| 1034 | struct fio_option *o; |
| 1035 | unsigned int i; |
| 1036 | |
| 1037 | options_init(options); |
| 1038 | |
| 1039 | i = 0; |
| 1040 | while (long_options[i].name) |
| 1041 | i++; |
| 1042 | |
| 1043 | o = &options[0]; |
| 1044 | while (o->name) { |
| 1045 | long_options[i].name = o->name; |
| 1046 | long_options[i].val = FIO_GETOPT_JOB; |
| 1047 | if (o->type == FIO_OPT_STR_SET) |
| 1048 | long_options[i].has_arg = no_argument; |
| 1049 | else |
| 1050 | long_options[i].has_arg = required_argument; |
| 1051 | |
| 1052 | i++; |
| 1053 | o++; |
| 1054 | assert(i < FIO_NR_OPTIONS); |
| 1055 | } |
| 1056 | } |
| 1057 | |
| 1058 | int fio_option_parse(struct thread_data *td, const char *opt) |
| 1059 | { |
| 1060 | return parse_option(opt, options, td); |
| 1061 | } |
| 1062 | |
| 1063 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) |
| 1064 | { |
| 1065 | return parse_cmd_option(opt, val, options, td); |
| 1066 | } |
| 1067 | |
| 1068 | void fio_fill_default_options(struct thread_data *td) |
| 1069 | { |
| 1070 | fill_default_options(td, options); |
| 1071 | } |
| 1072 | |
| 1073 | int fio_show_option_help(const char *opt) |
| 1074 | { |
| 1075 | return show_cmd_help(options, opt); |
| 1076 | } |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1077 | |
| 1078 | static void __options_mem(struct thread_data *td, int alloc) |
| 1079 | { |
| 1080 | struct thread_options *o = &td->o; |
| 1081 | struct fio_option *opt; |
| 1082 | char **ptr; |
| 1083 | int i; |
| 1084 | |
| 1085 | for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) { |
| 1086 | if (opt->type != FIO_OPT_STR_STORE) |
| 1087 | continue; |
| 1088 | |
| 1089 | ptr = (void *) o + opt->off1; |
| 1090 | if (*ptr) { |
| 1091 | if (alloc) |
| 1092 | *ptr = strdup(*ptr); |
| 1093 | else { |
| 1094 | free(*ptr); |
| 1095 | *ptr = NULL; |
| 1096 | } |
| 1097 | } |
| 1098 | } |
| 1099 | } |
| 1100 | |
| 1101 | /* |
| 1102 | * dupe FIO_OPT_STR_STORE options |
| 1103 | */ |
| 1104 | void options_mem_dupe(struct thread_data *td) |
| 1105 | { |
| 1106 | __options_mem(td, 1); |
| 1107 | } |
| 1108 | |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1109 | void options_mem_free(struct thread_data fio_unused *td) |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1110 | { |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1111 | #if 0 |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1112 | __options_mem(td, 0); |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1113 | #endif |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1114 | } |