eta: show complete status line with max job states
authorSitsofe Wheeler <sitsofe@yahoo.com>
Sat, 23 Dec 2017 09:55:02 +0000 (09:55 +0000)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Sun, 24 Dec 2017 23:34:39 +0000 (23:34 +0000)
Make the ETA output buffer big enough to cope with the maximum possible
jobs when their states can't be compressed (i.e. when every job's state
is different to the state of the job that came before it).

Allows the following script to display the complete status line:

rw[0]='read'; rw[1]='write'; \
for i in {1..4096}; do \
  echo -e "[job$i]\nrw=${rw[$((i % 2))]}\n" \
          "runtime=15"; \
done | \
./fio --eta=always --group_reporting=1 --ioengine=null --size=1g \
 --time_based --bs=1k --thread --rate_iops=1 -

Fixes: https://github.com/axboe/fio/issues/500 ("Large number of threads
result in Seg faults")

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
eta.c

diff --git a/eta.c b/eta.c
index d019747..0b79526 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -520,7 +520,7 @@ void display_thread_status(struct jobs_eta *je)
        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;
+       char output[__THREAD_RUNSTR_SZ(REAL_MAX_JOBS) + 512], *p = output;
        char eta_str[128];
        double perc = 0.0;