implement 'unit_base' option to select between KB and Kbit et. al.
With network testing, it's often desirable to measure in terms of
kilobits/megabits rather than kilobytes/megabytes. This adds an option named
'unit_base' which can be set to either '1' or '8', where '1' means represent in
terms of bits and '8' means to represent rate in terms of bytes.
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/eta.c b/eta.c
index e08b5f7..50d229c 100644
--- a/eta.c
+++ b/eta.c
@@ -319,6 +319,7 @@
unified_rw_rep += td->o.unified_rw_rep;
if (is_power_of_2(td->o.kb_base))
je->is_pow2 = 1;
+ je->unit_base = td->o.unit_base;
if (td->o.bw_avg_time < bw_avg_time)
bw_avg_time = td->o.bw_avg_time;
if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING
@@ -474,7 +475,7 @@
for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++) {
rate_str[ddir] = num2str(je->rate[ddir], 5,
- 1024, je->is_pow2, 8);
+ 1024, je->is_pow2, je->unit_base);
iops_str[ddir] = num2str(je->iops[ddir], 4, 1, 0, 0);
}