X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=eta.c;h=5b912eb7166c81b1cb310e42a5c61701ecb6e9c0;hp=e8dfd288b69241c418a62fd97dcb8e816a5f1dc2;hb=a7de0a1163e63cb6fa0a6bad773c415d06d154ac;hpb=cf451d1ede3bbbd2fed3619eb43def054d5b5a5a diff --git a/eta.c b/eta.c index e8dfd288..5b912eb7 100644 --- a/eta.c +++ b/eta.c @@ -343,6 +343,9 @@ int calc_thread_status(struct jobs_eta *je) if (!je->nr_running && !je->nr_pending) return 0; + je->nr_threads = thread_number; + memcpy(je->run_str, run_str, thread_number * sizeof(char)); + return 1; } @@ -392,8 +395,8 @@ void display_thread_status(struct jobs_eta *je) iops_str[1] = num2str(je->iops[1], 4, 1, 0); l = sprintf(p, ": [%s] [%s] [%s/%s /s] [%s/%s iops] [eta %s]", - run_str, perc_str, rate_str[0], rate_str[1], - iops_str[0], iops_str[1], eta_str); + je->run_str, perc_str, rate_str[0], + rate_str[1], iops_str[0], iops_str[1], eta_str); p += l; if (l >= 0 && l < linelen_last) p += sprintf(p, "%*s", linelen_last - l, ""); @@ -412,14 +415,16 @@ void display_thread_status(struct jobs_eta *je) void print_thread_status(void) { - struct jobs_eta je; + struct jobs_eta *je; + + je = malloc(sizeof(*je) + thread_number * sizeof(char)); - memset(&je, 0, sizeof(je)); + memset(je, 0, sizeof(*je) + thread_number * sizeof(char)); - if (!calc_thread_status(&je)) - return; + if (calc_thread_status(je)) + display_thread_status(je); - display_thread_status(&je); + free(je); } void print_status_init(int thr_number)