Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio
authorJens Axboe <axboe@kernel.dk>
Sun, 24 Feb 2013 13:24:16 +0000 (14:24 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 24 Feb 2013 13:24:16 +0000 (14:24 +0100)
README
eta.c
fio.h
init.c

diff --git a/README b/README
index 4f796e3003e3cfad62cdb2c3021f12dba211706a..b662e714d62bb6f88f3880c5b5607c52a31556b6 100644 (file)
--- a/README
+++ b/README
@@ -152,6 +152,7 @@ $ fio
                                writes
        --eta=when              When ETA estimate should be printed
                                May be "always", "never" or "auto"
+       --eta-newline=time      Force a new line for every 'time' period passed
        --section=name          Only run specified section in job file.
                                Multiple sections can be specified.
        --alloc-size=kb         Set smalloc pool to this size in kb (def 1024)
diff --git a/eta.c b/eta.c
index 5ef31c692cf8b9a32bd366710fcc81af4cb71623..f90d428197656f362fcdf199865a65f06dbebbec 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -422,12 +422,13 @@ int calc_thread_status(struct jobs_eta *je, int force)
 
        je->nr_threads = thread_number;
        memcpy(je->run_str, run_str, thread_number * sizeof(char));
-
        return 1;
 }
 
 void display_thread_status(struct jobs_eta *je)
 {
+       static struct timeval disp_eta_new_line;
+       static int eta_new_line_init, eta_new_line_pending;
        static int linelen_last;
        static int eta_good;
        char output[REAL_MAX_JOBS + 512], *p = output;
@@ -439,6 +440,11 @@ void display_thread_status(struct jobs_eta *je)
                eta_to_str(eta_str, je->eta_sec);
        }
 
+       if (eta_new_line_pending) {
+               eta_new_line_pending = 0;
+               p += sprintf(p, "\n");
+       }
+
        p += sprintf(p, "Jobs: %d (f=%d)", je->nr_running, je->files_open);
        if (je->m_rate || je->t_rate) {
                char *tr, *mr;
@@ -492,6 +498,16 @@ void display_thread_status(struct jobs_eta *je)
        p += sprintf(p, "\r");
 
        printf("%s", output);
+
+       if (!eta_new_line_init) {
+               fio_gettime(&disp_eta_new_line, NULL);
+               eta_new_line_init = 1;
+       } else if (eta_new_line &&
+                  mtime_since_now(&disp_eta_new_line) > eta_new_line * 1000) {
+               fio_gettime(&disp_eta_new_line, NULL);
+               eta_new_line_pending = 1;
+       }
+
        fflush(stdout);
 }
 
diff --git a/fio.h b/fio.h
index 43f48543ed63db3ab4afdabc9cb9a78dfbfcf515..d7eb6dea65a68c3b312025ea1c342ecb5e3da249 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -594,6 +594,7 @@ extern unsigned long long mlock_size;
 extern uintptr_t page_mask, page_size;
 extern int read_only;
 extern int eta_print;
+extern int eta_new_line;
 extern unsigned long done_secs;
 extern char *job_section;
 extern int fio_gtod_offload;
diff --git a/init.c b/init.c
index 4709ff29146292a41b6994b450b68730ce8a3032..32da42c5d8e4ba2ab86dbf4e2888cb7af05eb5ff 100644 (file)
--- a/init.c
+++ b/init.c
@@ -41,6 +41,7 @@ struct thread_data *threads = NULL;
 int exitall_on_terminate = 0;
 int output_format = FIO_OUTPUT_NORMAL;
 int eta_print = FIO_ETA_AUTO;
+int eta_new_line = 0;
 unsigned long long mlock_size = 0;
 FILE *f_out = NULL;
 FILE *f_err = NULL;
@@ -139,6 +140,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
                .has_arg        = required_argument,
                .val            = 'e' | FIO_CLIENT_FLAG,
        },
+       {
+               .name           = (char *) "eta-newline",
+               .has_arg        = required_argument,
+               .val            = 'E' | FIO_CLIENT_FLAG,
+       },
        {
                .name           = (char *) "debug",
                .has_arg        = required_argument,
@@ -1264,6 +1270,8 @@ static void usage(const char *name)
        printf("  --showcmd\t\tTurn a job file into command line options\n");
        printf("  --eta=when\t\tWhen ETA estimate should be printed\n");
        printf("            \t\tMay be \"always\", \"never\" or \"auto\"\n");
+       printf("  --eta-newline=time\tForce a new line for every 'time'");
+       printf(" period passed\n");
        printf("  --readonly\t\tTurn on safety read-only checks, preventing"
                " writes\n");
        printf("  --section=name\tOnly run specified section in job file\n");
@@ -1505,6 +1513,17 @@ int parse_cmd_line(int argc, char *argv[])
                        else if (!strcmp("never", optarg))
                                eta_print = FIO_ETA_NEVER;
                        break;
+               case 'E': {
+                       long long t = 0;
+
+                       if (str_to_decimal(optarg, &t, 0, NULL)) {
+                               log_err("fio: failed parsing eta time %s\n", optarg);
+                               exit_val = 1;
+                               do_exit++;
+                       }
+                       eta_new_line = t;
+                       break;
+                       }
                case 'd':
                        if (set_debug(optarg))
                                do_exit++;