- unsigned long elapsed = mtime_since_genesis() / 1000;
- int i, nr_running, nr_pending, t_rate, m_rate, *eta_secs, eta_sec;
- char eta_str[32];
- double perc = 0.0;
-
- if (temp_stall_ts || terse_output)
- return;
-
- eta_secs = malloc(thread_number * sizeof(int));
- memset(eta_secs, 0, thread_number * sizeof(int));
-
- nr_pending = nr_running = t_rate = m_rate = 0;
- for (i = 0; i < thread_number; i++) {
- struct thread_data *td = &threads[i];
-
- if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING||
- td->runstate == TD_FSYNCING) {
- nr_running++;
- t_rate += td->rate;
- m_rate += td->ratemin;
+ struct thread_data *td;
+ int i;
+ unsigned long rate_time, disp_time, bw_avg_time, *eta_secs;
+ unsigned long long io_bytes[2];
+ unsigned long long io_iops[2];
+ struct timeval now;
+
+ static unsigned long long rate_io_bytes[2];
+ static unsigned long long disp_io_bytes[2];
+ static unsigned long long disp_io_iops[2];
+ static struct timeval rate_prev_time, disp_prev_time;
+ int i2p = 0;
+
+ if (temp_stall_ts || terse_output || eta_print == FIO_ETA_NEVER)
+ return 0;
+
+ if (!isatty(STDOUT_FILENO) && (eta_print != FIO_ETA_ALWAYS))
+ return 0;
+
+ if (!rate_io_bytes[0] && !rate_io_bytes[1])
+ fill_start_time(&rate_prev_time);
+ if (!disp_io_bytes[0] && !disp_io_bytes[1])
+ fill_start_time(&disp_prev_time);
+
+ eta_secs = malloc(thread_number * sizeof(unsigned long));
+ memset(eta_secs, 0, thread_number * sizeof(unsigned long));
+
+ je->elapsed_sec = (mtime_since_genesis() + 999) / 1000;
+
+ io_bytes[0] = io_bytes[1] = 0;
+ io_iops[0] = io_iops[1] = 0;
+ bw_avg_time = ULONG_MAX;
+ for_each_td(td, i) {
+ if (td->o.bw_avg_time < bw_avg_time)
+ bw_avg_time = td->o.bw_avg_time;
+ if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING
+ || td->runstate == TD_FSYNCING
+ || td->runstate == TD_PRE_READING) {
+ je->nr_running++;
+ je->t_rate += td->o.rate[0] + td->o.rate[1];
+ je->m_rate += td->o.ratemin[0] + td->o.ratemin[1];
+ je->t_iops += td->o.rate_iops[0] + td->o.rate_iops[1];
+ je->m_iops += td->o.rate_iops_min[0] +
+ td->o.rate_iops_min[1];
+ je->files_open += td->nr_open_files;
+ } else if (td->runstate == TD_RAMP) {
+ je->nr_running++;
+ je->nr_ramp++;