- printf("Jobs: %d (f=%d)", nr_running, files_open);
- if (m_rate || t_rate)
- printf(", CR=%d/%d KiB/s", t_rate, m_rate);
- else if (m_iops || t_iops)
- printf(", CR=%d/%d IOPS", t_iops, m_iops);
- if (eta_sec != INT_MAX && nr_running) {
+void display_thread_status(struct jobs_eta *je)
+{
+ static int linelen_last;
+ static int eta_good;
+ char output[REAL_MAX_JOBS + 512], *p = output;
+ char eta_str[128];
+ double perc = 0.0;
+
+ if (je->eta_sec != INT_MAX && je->elapsed_sec) {
+ perc = (double) je->elapsed_sec / (double) (je->elapsed_sec + je->eta_sec);
+ eta_to_str(eta_str, je->eta_sec);
+ }
+
+ p += sprintf(p, "Jobs: %d (f=%d)", je->nr_running, je->files_open);
+ if (je->m_rate || je->t_rate) {
+ char *tr, *mr;
+
+ mr = num2str(je->m_rate, 4, 0, je->is_pow2);
+ tr = num2str(je->t_rate, 4, 0, je->is_pow2);
+ p += sprintf(p, ", CR=%s/%s KB/s", tr, mr);
+ free(tr);
+ free(mr);
+ } else if (je->m_iops || je->t_iops)
+ p += sprintf(p, ", CR=%d/%d IOPS", je->t_iops, je->m_iops);
+ if (je->eta_sec != INT_MAX && je->nr_running) {