Add a get_jobs_eta() to return jobs eta information
We duplicate this code in eta.c and server.c, consolidate it.
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/server.c b/server.c
index e20f592..76b6b54 100644
--- a/server.c
+++ b/server.c
@@ -666,22 +666,14 @@
static int handle_send_eta_cmd(struct fio_net_cmd *cmd)
{
struct jobs_eta *je;
- size_t size;
uint64_t tag = cmd->tag;
+ size_t size;
int i;
- if (!thread_number)
+ je = get_jobs_eta(1, &size);
+ if (!je)
return 0;
- size = sizeof(*je) + THREAD_RUNSTR_SZ;
- je = malloc(size);
- memset(je, 0, size);
-
- if (!calc_thread_status(je, 1)) {
- free(je);
- return 0;
- }
-
dprint(FD_NET, "server sending status\n");
je->nr_running = cpu_to_le32(je->nr_running);