eta: improve output for threads sitting in TD_SETTING_UP
authorJens Axboe <axboe@kernel.dk>
Mon, 15 Apr 2013 08:21:56 +0000 (10:21 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 15 Apr 2013 08:21:56 +0000 (10:21 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
client.c
eta.c
server.c
server.h
stat.h

index 13e84f6..3cb46ab 100644 (file)
--- a/client.c
+++ b/client.c
@@ -887,6 +887,7 @@ static void convert_jobs_eta(struct jobs_eta *je)
        je->nr_running          = le32_to_cpu(je->nr_running);
        je->nr_ramp             = le32_to_cpu(je->nr_ramp);
        je->nr_pending          = le32_to_cpu(je->nr_pending);
+       je->nr_setting_up       = le32_to_cpu(je->nr_setting_up);
        je->files_open          = le32_to_cpu(je->files_open);
 
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
@@ -912,6 +913,7 @@ void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je)
        dst->nr_running         += je->nr_running;
        dst->nr_ramp            += je->nr_ramp;
        dst->nr_pending         += je->nr_pending;
+       dst->nr_setting_up      += je->nr_setting_up;
        dst->files_open         += je->files_open;
 
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
diff --git a/eta.c b/eta.c
index 769ac14..9fc6e27 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -186,6 +186,7 @@ static int thread_eta(struct thread_data *td)
                        eta_sec = td->o.timeout + done_secs - elapsed;
        } else if (td->runstate == TD_NOT_CREATED || td->runstate == TD_CREATED
                        || td->runstate == TD_INITIALIZED
+                       || td->runstate == TD_SETTING_UP
                        || td->runstate == TD_RAMP
                        || td->runstate == TD_PRE_READING) {
                int t_eta = 0, r_eta = 0;
@@ -349,9 +350,10 @@ int calc_thread_status(struct jobs_eta *je, int force)
                } else if (td->runstate == TD_RAMP) {
                        je->nr_running++;
                        je->nr_ramp++;
-               } else if (td->runstate == TD_SETTING_UP)
+               } else if (td->runstate == TD_SETTING_UP) {
                        je->nr_running++;
-               else if (td->runstate < TD_RUNNING)
+                       je->nr_setting_up++;
+               } else if (td->runstate < TD_RUNNING)
                        je->nr_pending++;
 
                if (je->elapsed_sec >= 3)
@@ -361,7 +363,7 @@ int calc_thread_status(struct jobs_eta *je, int force)
 
                check_str_update(td);
 
-               if (td->runstate > TD_RAMP) {
+               if (td->runstate > TD_SETTING_UP) {
                        int ddir;
 
                        for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++) {
@@ -471,8 +473,13 @@ void display_thread_status(struct jobs_eta *je)
                if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running)
                        strcpy(perc_str, "-.-% done");
                else {
+                       double mult = 100.0;
+
+                       if (je->nr_setting_up && je->nr_running)
+                               mult *= (1.0 - (double) je->nr_setting_up / (double) je->nr_running);
+
                        eta_good = 1;
-                       perc *= 100.0;
+                       perc *= mult;
                        sprintf(perc_str, "%3.1f%% done", perc);
                }
 
index 884ff8e..e3fbf0f 100644 (file)
--- a/server.c
+++ b/server.c
@@ -681,6 +681,7 @@ static int handle_send_eta_cmd(struct fio_net_cmd *cmd)
        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->nr_setting_up       = cpu_to_le32(je->nr_setting_up);
        je->files_open          = cpu_to_le32(je->files_open);
 
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
index 478c283..46745aa 100644 (file)
--- a/server.h
+++ b/server.h
@@ -38,7 +38,7 @@ struct fio_net_cmd_reply {
 };
 
 enum {
-       FIO_SERVER_VER                  = 22,
+       FIO_SERVER_VER                  = 23,
 
        FIO_SERVER_MAX_FRAGMENT_PDU     = 1024,
 
diff --git a/stat.h b/stat.h
index 76a71d4..0125f57 100644 (file)
--- a/stat.h
+++ b/stat.h
@@ -181,6 +181,7 @@ struct jobs_eta {
        uint32_t nr_running;
        uint32_t nr_ramp;
        uint32_t nr_pending;
+       uint32_t nr_setting_up;
        uint32_t files_open;
        uint32_t m_rate[DDIR_RWDIR_CNT], t_rate[DDIR_RWDIR_CNT];
        uint32_t m_iops[DDIR_RWDIR_CNT], t_iops[DDIR_RWDIR_CNT];