X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=eta.c;h=47e9e339514dd4780bab3a7f049c79e0a7ff6101;hb=721938ae7fae0f6d470a7e32e177ea5dce480229;hp=601c9c7ebca2cb53fcd1c89a52c1212041c67cb0;hpb=0721d11e4d9807e40385e06b419824e9a875525c;p=fio.git diff --git a/eta.c b/eta.c index 601c9c7e..47e9e339 100644 --- a/eta.c +++ b/eta.c @@ -66,13 +66,11 @@ static void check_str_update(struct thread_data *td) /* * Convert seconds to a printable string. */ -static void eta_to_str(char *str, int eta_sec) +static void eta_to_str(char *str, unsigned long eta_sec) { unsigned int d, h, m, s; int disp_hour = 0; - d = h = m = s = 0; - s = eta_sec % 60; eta_sec /= 60; m = eta_sec % 60; @@ -117,6 +115,9 @@ static int thread_eta(struct thread_data *td, unsigned long elapsed) if (td->o.zone_size && td->o.zone_skip) bytes_total /= (td->o.zone_skip / td->o.zone_size); + if (td->o.fill_device && td->o.size == -1ULL) + return 0; + if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING) { double perc, perc_t; @@ -199,6 +200,7 @@ void print_thread_status(void) static struct timeval rate_prev_time, disp_prev_time; static unsigned int rate[2]; static int linelen_last; + static int eta_good; if (temp_stall_ts || terse_output || eta_print == FIO_ETA_NEVER) return; @@ -248,8 +250,13 @@ void print_thread_status(void) eta_sec = 0; for_each_td(td, i) { - if (eta_secs[i] != INT_MAX) - eta_sec += eta_secs[i]; + if (exitall_on_terminate) { + if (eta_secs[i] < eta_sec) + eta_sec = eta_secs[i]; + } else { + if (eta_secs[i] > eta_sec) + eta_sec = eta_secs[i]; + } } free(eta_secs); @@ -288,12 +295,14 @@ void print_thread_status(void) char perc_str[32]; int ll; - if (!eta_sec) - strcpy(perc_str, "--- done"); - else + if (!eta_sec && !eta_good) + strcpy(perc_str, "-.-% done"); + else { + eta_good = 1; + perc *= 100.0; sprintf(perc_str, "%3.1f%% done", perc); + } - perc *= 100.0; ll = printf(": [%s] [%s] [%6u/%6u kb/s] [eta %s]", run_str, perc_str, rate[0], rate[1], eta_str); if (ll >= 0 && ll < linelen_last)