server: add ETA as a specific command
[fio.git] / server.c
index 7202f10fcbbd542e9d9bdc05319c20c8a24041a1..32add58a85108eeb61aa3b2345fae73a76f078e5 100644 (file)
--- a/server.c
+++ b/server.c
@@ -543,6 +543,34 @@ void fio_server_send_gs(struct group_run_stats *rs)
        fio_net_send_cmd(server_fd, FIO_NET_CMD_GS, &gs, sizeof(gs));
 }
 
        fio_net_send_cmd(server_fd, FIO_NET_CMD_GS, &gs, sizeof(gs));
 }
 
+void fio_server_send_status(void)
+{
+       struct jobs_eta je;
+       int i;
+
+       if (!calc_thread_status(&je))
+               return;
+
+       je.nr_running           = cpu_to_le32(je.nr_running);
+       je.nr_ramp              = cpu_to_le32(je.nr_ramp);
+       je.nr_pending           = cpu_to_le32(je.nr_pending);
+       je.files_open           = cpu_to_le32(je.files_open);
+       je.m_rate               = cpu_to_le32(je.m_rate);
+       je.t_rate               = cpu_to_le32(je.t_rate);
+       je.m_iops               = cpu_to_le32(je.m_iops);
+       je.t_iops               = cpu_to_le32(je.t_iops);
+
+       for (i = 0; i < 2; i++) {
+               je.rate[i]      = cpu_to_le32(je.rate[i]);
+               je.iops[i]      = cpu_to_le32(je.iops[i]);
+       }
+
+       je.elapsed_sec          = cpu_to_le32(je.nr_running);
+       je.eta_sec              = cpu_to_le64(je.eta_sec);
+
+       fio_net_send_cmd(server_fd, FIO_NET_CMD_ETA, &je, sizeof(je));
+}
+
 int fio_server_log(const char *format, ...)
 {
        char buffer[1024];
 int fio_server_log(const char *format, ...)
 {
        char buffer[1024];