X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=eta.c;h=531b876280b2176d3784d6d50073d2d47797e146;hp=a724fe63936bc64caa0719871c9ff90cfb522c49;hb=8ea39c32d29428b17bfe9c806fc33f0c8adfe118;hpb=29df29eaf88958c8741103d2056a4773d4959d9d;ds=sidebyside diff --git a/eta.c b/eta.c index a724fe63..531b8762 100644 --- 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[0] || je->m_rate[1] || je->t_rate[0] || je->t_rate[1]) { char *tr, *mr; @@ -495,6 +501,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); }