group reporting: fix bad values of min/max
authorJens Axboe <axboe@kernel.dk>
Thu, 5 Apr 2012 14:42:11 +0000 (08:42 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 5 Apr 2012 14:42:11 +0000 (08:42 -0600)
If you look at the fio output, the group reporting min and max
bandwidth don't match what the actual job reports. This is due
to an error in calculating the min and max values. The aggregate
value is correct, and matches what the job reports.

This did not affect the values that are usually used for reporting,
it's only affecting the group run status output.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat.c

diff --git a/stat.c b/stat.c
index 26f45f4d39a4c58bd6c6fca9c8262cf10c9b2f6d..2ab5f1adffd49a203ba6d0fd567e891fbc27f613 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1045,10 +1045,11 @@ void show_run_stats(void)
 
                        bw = 0;
                        if (ts->runtime[j]) {
-                               unsigned long runt;
+                               unsigned long runt = ts->runtime[j];
+                               unsigned long long kb;
 
-                               runt = ts->runtime[j];
-                               bw = ts->io_bytes[j] / runt;
+                               kb = ts->io_bytes[j] / rs->kb_base;
+                               bw = kb * 1000 / runt;
                        }
                        if (bw < rs->min_bw[j])
                                rs->min_bw[j] = bw;
@@ -1060,16 +1061,12 @@ void show_run_stats(void)
        }
 
        for (i = 0; i < groupid + 1; i++) {
-               unsigned long max_run[2];
-
                rs = &runstats[i];
-               max_run[0] = rs->max_run[0];
-               max_run[1] = rs->max_run[1];
 
                if (rs->max_run[0])
-                       rs->agg[0] = (rs->io_kb[0] * 1000) / max_run[0];
+                       rs->agg[0] = (rs->io_kb[0] * 1000) / rs->max_run[0];
                if (rs->max_run[1])
-                       rs->agg[1] = (rs->io_kb[1] * 1000) / max_run[1];
+                       rs->agg[1] = (rs->io_kb[1] * 1000) / rs->max_run[1];
        }
 
        /*