Scale bw output to MB/sec if larger than 99999 KB/sec
authorJens Axboe <axboe@kernel.dk>
Fri, 14 Oct 2011 07:30:01 +0000 (09:30 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 14 Oct 2011 07:30:01 +0000 (09:30 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat.c

diff --git a/stat.c b/stat.c
index d611a7261ec1cd5515e858486d4b2549d5e289f2..852d3f1d2206200bfddc39d225b6c3da81176f24 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -441,11 +441,23 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
        }
        if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
                double p_of_agg;
+               const char *bw_str = "KB";
 
                p_of_agg = mean * 100 / (double) rs->agg[ddir];
-               log_info("     bw (KB/s) : min=%5lu, max=%5lu, per=%3.2f%%,"
-                        " avg=%5.02f, stdev=%5.02f\n", min, max, p_of_agg,
-                                                       mean, dev);
+               if (p_of_agg > 100.0)
+                       p_of_agg = 100.0;
+
+               if (mean > 999999.9) {
+                       min /= 1000.0;
+                       max /= 1000.0;
+                       mean /= 1000.0;
+                       dev /= 1000.0;
+                       bw_str = "MB";
+               }
+
+               log_info("     bw (%s/s) : min=%5lu, max=%5lu, per=%3.2f%%,"
+                        " avg=%5.02f, stdev=%5.02f\n", bw_str, min, max,
+                                                       p_of_agg, mean, dev);
        }
 }