+ printf("\t--eta=when\tWhen ETA estimate should be printed\n");
+ printf("\t \tMay be \"always\", \"never\" or \"auto\"\n");
+ printf("\t--readonly\tTurn on safety read-only checks, preventing"
+ " writes\n");
+ printf("\t--section=name\tOnly run specified section in job file\n");
+ printf("\t--alloc-size=kb\tSet smalloc pool to this size in kb"
+ " (def 1024)\n");
+ printf("\t--warnings-fatal Fio parser warnings are fatal\n");
+ printf("\nFio was written by Jens Axboe <jens.axboe@oracle.com>");
+ printf("\n Jens Axboe <jaxboe@fusionio.com>\n");
+}
+
+#ifdef FIO_INC_DEBUG
+struct debug_level debug_levels[] = {
+ { .name = "process", .shift = FD_PROCESS, },
+ { .name = "file", .shift = FD_FILE, },
+ { .name = "io", .shift = FD_IO, },
+ { .name = "mem", .shift = FD_MEM, },
+ { .name = "blktrace", .shift = FD_BLKTRACE },
+ { .name = "verify", .shift = FD_VERIFY },
+ { .name = "random", .shift = FD_RANDOM },
+ { .name = "parse", .shift = FD_PARSE },
+ { .name = "diskutil", .shift = FD_DISKUTIL },
+ { .name = "job", .shift = FD_JOB },
+ { .name = "mutex", .shift = FD_MUTEX },
+ { .name = "profile", .shift = FD_PROFILE },
+ { .name = "time", .shift = FD_TIME },
+ { .name = NULL, },
+};
+
+static int set_debug(const char *string)
+{
+ struct debug_level *dl;
+ char *p = (char *) string;
+ char *opt;
+ int i;
+
+ if (!strcmp(string, "?") || !strcmp(string, "help")) {
+ int i;
+
+ log_info("fio: dumping debug options:");
+ for (i = 0; debug_levels[i].name; i++) {
+ dl = &debug_levels[i];
+ log_info("%s,", dl->name);
+ }
+ log_info("all\n");
+ return 1;
+ }
+
+ while ((opt = strsep(&p, ",")) != NULL) {
+ int found = 0;
+
+ if (!strncmp(opt, "all", 3)) {
+ log_info("fio: set all debug options\n");
+ fio_debug = ~0UL;
+ continue;
+ }
+
+ for (i = 0; debug_levels[i].name; i++) {
+ dl = &debug_levels[i];
+ found = !strncmp(opt, dl->name, strlen(dl->name));
+ if (!found)
+ continue;
+
+ if (dl->shift == FD_JOB) {
+ opt = strchr(opt, ':');
+ if (!opt) {
+ log_err("fio: missing job number\n");
+ break;
+ }
+ opt++;
+ fio_debug_jobno = atoi(opt);
+ log_info("fio: set debug jobno %d\n",
+ fio_debug_jobno);
+ } else {
+ log_info("fio: set debug option %s\n", opt);
+ fio_debug |= (1UL << dl->shift);
+ }
+ break;
+ }
+
+ if (!found)
+ log_err("fio: debug mask %s not found\n", opt);
+ }
+ return 0;
+}
+#else
+static int set_debug(const char *string)
+{
+ log_err("fio: debug tracing not included in build\n");
+ return 1;
+}
+#endif
+
+static void fio_options_fill_optstring(void)
+{
+ char *ostr = cmd_optstr;
+ int i, c;
+
+ c = i = 0;
+ while (l_opts[i].name) {
+ ostr[c++] = l_opts[i].val;
+ if (l_opts[i].has_arg == required_argument)
+ ostr[c++] = ':';
+ else if (l_opts[i].has_arg == optional_argument) {
+ ostr[c++] = ':';
+ ostr[c++] = ':';
+ }
+ i++;
+ }
+ ostr[c] = '\0';