Add support for multiple output formats
[fio.git] / init.c
diff --git a/init.c b/init.c
index 6d8dcffde9100f0001e5dba7a0912033d98ab166..e7faca10ca1dd448e48867a1602c2d5e61710465 100644 (file)
--- a/init.c
+++ b/init.c
@@ -69,6 +69,8 @@ long long trigger_timeout = 0;
 char *trigger_cmd = NULL;
 char *trigger_remote_cmd = NULL;
 
+char *aux_path = NULL;
+
 static int prev_group_jobs;
 
 unsigned long fio_debug = 0;
@@ -266,6 +268,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
                .has_arg        = required_argument,
                .val            = 'J',
        },
+       {
+               .name           = (char *) "aux-path",
+               .has_arg        = required_argument,
+               .val            = 'K',
+       },
        {
                .name           = NULL,
        },
@@ -458,7 +465,7 @@ static int __setup_rate(struct thread_data *td, enum fio_ddir ddir)
        if (td->o.rate[ddir])
                td->rate_bps[ddir] = td->o.rate[ddir];
        else
-               td->rate_bps[ddir] = td->o.rate_iops[ddir] * bs;
+               td->rate_bps[ddir] = (uint64_t) td->o.rate_iops[ddir] * bs;
 
        if (!td->rate_bps[ddir]) {
                log_err("rate lower than supported\n");
@@ -623,6 +630,13 @@ static int fixup_options(struct thread_data *td)
        if (o->iodepth_batch > o->iodepth || !o->iodepth_batch)
                o->iodepth_batch = o->iodepth;
 
+       /*
+        * If max batch complete number isn't set or set incorrectly,
+        * default to the same as iodepth_batch_complete_min
+        */
+       if (o->iodepth_batch_complete_min > o->iodepth_batch_complete_max)
+               o->iodepth_batch_complete_max = o->iodepth_batch_complete_min;
+
        if (o->nr_files > td->files_index)
                o->nr_files = td->files_index;
 
@@ -1303,7 +1317,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
        if (!o->name)
                o->name = strdup(jobname);
 
-       if (output_format == FIO_OUTPUT_NORMAL) {
+       if (output_format & FIO_OUTPUT_NORMAL) {
                if (!job_add_num) {
                        if (is_backend && !recursed)
                                fio_server_send_add_job(td);
@@ -1793,6 +1807,7 @@ static void usage(const char *name)
        printf("  --trigger-timeout=t\tExecute trigger af this time\n");
        printf("  --trigger=cmd\t\tSet this command as local trigger\n");
        printf("  --trigger-remote=cmd\tSet this command as remote trigger\n");
+       printf("  --aux-path=path\tUse this path for fio state generated files\n");
        printf("\nFio was written by Jens Axboe <jens.axboe@oracle.com>");
        printf("\n                   Jens Axboe <jaxboe@fusionio.com>");
        printf("\n                   Jens Axboe <axboe@fb.com>\n");
@@ -1990,7 +2005,7 @@ static void show_closest_option(const char *name)
                i++;
        }
 
-       if (best_option != -1)
+       if (best_option != -1 && string_distance_ok(name, best_distance))
                log_err("Did you mean %s?\n", l_opts[best_option].name);
 }
 
@@ -2383,6 +2398,11 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                                free(trigger_remote_cmd);
                        trigger_remote_cmd = strdup(optarg);
                        break;
+               case 'K':
+                       if (aux_path)
+                               free(aux_path);
+                       aux_path = strdup(optarg);
+                       break;
                case 'B':
                        if (check_str_time(optarg, &trigger_timeout, 1)) {
                                log_err("fio: failed parsing time %s\n", optarg);
@@ -2512,7 +2532,7 @@ int parse_options(int argc, char *argv[])
                return 0;
        }
 
-       if (output_format == FIO_OUTPUT_NORMAL)
+       if (output_format & FIO_OUTPUT_NORMAL)
                log_info("%s\n", fio_version_string);
 
        return 0;