X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=eta.c;h=fdf55c5ab74d260d7c8aa1be842002c5a75b1d25;hb=731ef4c7c0aad1e6717e645595f3454d264b4f2f;hp=e2a5a29ab3dcdf223ec5071c5fe6c5e636aacef7;hpb=6eaf09d6e9ca1f8accb057cdb18620b7e53ae33f;p=fio.git diff --git a/eta.c b/eta.c index e2a5a29a..fdf55c5a 100644 --- a/eta.c +++ b/eta.c @@ -78,6 +78,7 @@ static void check_str_update(struct thread_data *td) c = 'C'; break; case TD_INITIALIZED: + case TD_SETTING_UP: c = 'I'; break; case TD_NOT_CREATED: @@ -139,13 +140,19 @@ static int thread_eta(struct thread_data *td) } /* - * if writing, bytes_total will be twice the size. If mixing, - * assume a 50/50 split and thus bytes_total will be 50% larger. + * if writing and verifying afterwards, bytes_total will be twice the + * size. In a mixed workload, verify phase will be the size of the + * first stage writes. */ if (td->o.do_verify && td->o.verify && td_write(td)) { - if (td_rw(td)) - bytes_total = bytes_total * 3 / 2; - else + if (td_rw(td)) { + unsigned int perc = 50; + + if (td->o.rwmix[DDIR_WRITE]) + perc = td->o.rwmix[DDIR_WRITE]; + + bytes_total += (bytes_total * perc) / 100; + } else bytes_total <<= 1; } @@ -155,8 +162,7 @@ static int thread_eta(struct thread_data *td) if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING) { double perc, perc_t; - bytes_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE] + - td->io_bytes[DDIR_TRIM]; + bytes_done = ddir_rw_sum(td->io_bytes); perc = (double) bytes_done / (double) bytes_total; if (perc > 1.0) perc = 1.0; @@ -177,6 +183,7 @@ static int thread_eta(struct thread_data *td) || td->runstate == TD_RAMP || td->runstate == TD_PRE_READING) { int t_eta = 0, r_eta = 0; + unsigned long long rate_bytes; /* * We can only guess - assume it'll run the full timeout @@ -195,11 +202,9 @@ static int thread_eta(struct thread_data *td) t_eta -= ramp_left; } } - if (td->o.rate[DDIR_READ] || td->o.rate[DDIR_WRITE] || - td->o.rate[DDIR_TRIM]) { - r_eta = (bytes_total / 1024) / - (td->o.rate[DDIR_READ] + td->o.rate[DDIR_WRITE] + - td->o.rate[DDIR_TRIM]); + rate_bytes = ddir_rw_sum(td->o.rate); + if (rate_bytes) { + r_eta = (bytes_total / 1024) / rate_bytes; r_eta += td->o.start_delay; } @@ -266,18 +271,18 @@ int calc_thread_status(struct jobs_eta *je, int force) static struct timeval rate_prev_time, disp_prev_time; if (!force) { - if (temp_stall_ts || terse_output || eta_print == FIO_ETA_NEVER) + if (output_format != FIO_OUTPUT_NORMAL) + return 0; + if (temp_stall_ts || eta_print == FIO_ETA_NEVER) return 0; if (!isatty(STDOUT_FILENO) && (eta_print != FIO_ETA_ALWAYS)) return 0; } - if (!rate_io_bytes[DDIR_READ] && !rate_io_bytes[DDIR_WRITE] && - !rate_io_bytes[DDIR_TRIM]) + if (!ddir_rw_sum(rate_io_bytes)) fill_start_time(&rate_prev_time); - if (!disp_io_bytes[DDIR_READ] && !disp_io_bytes[DDIR_WRITE] && - !disp_io_bytes[DDIR_TRIM]) + if (!ddir_rw_sum(disp_io_bytes)) fill_start_time(&disp_prev_time); eta_secs = malloc(thread_number * sizeof(unsigned long)); @@ -320,7 +325,9 @@ int calc_thread_status(struct jobs_eta *je, int force) } else if (td->runstate == TD_RAMP) { je->nr_running++; je->nr_ramp++; - } else if (td->runstate < TD_RUNNING) + } else if (td->runstate == TD_SETTING_UP) + je->nr_running++; + else if (td->runstate < TD_RUNNING) je->nr_pending++; if (je->elapsed_sec >= 3)