From aedd021de4d7564ebca3414f22c65ff6d34d2da4 Mon Sep 17 00:00:00 2001 From: Sitsofe Wheeler Date: Fri, 3 Nov 2017 07:23:55 +0000 Subject: [PATCH] stat: add bw_bytes JSON key Fixes: https://github.com/axboe/fio/issues/422 Signed-off-by: Sitsofe Wheeler --- stat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stat.c b/stat.c index c8a45dbd..89e2e6cb 100644 --- a/stat.c +++ b/stat.c @@ -956,7 +956,7 @@ static void add_ddir_status_json(struct thread_stat *ts, struct group_run_stats *rs, int ddir, struct json_object *parent) { unsigned long long min, max, minv, maxv; - unsigned long long bw; + unsigned long long bw_bytes, bw; unsigned long long *ovals = NULL; double mean, dev, iops; unsigned int len; @@ -975,17 +975,20 @@ static void add_ddir_status_json(struct thread_stat *ts, json_object_add_value_object(parent, ts->unified_rw_rep ? "mixed" : ddirname[ddir], dir_object); + bw_bytes = 0; bw = 0; iops = 0.0; if (ts->runtime[ddir]) { uint64_t runt = ts->runtime[ddir]; - bw = ((1000 * ts->io_bytes[ddir]) / runt) / 1024; /* KiB/s */ + bw_bytes = ((1000 * ts->io_bytes[ddir]) / runt); /* Bytes/s */ + bw = bw_bytes / 1024; /* KiB/s */ iops = (1000.0 * (uint64_t) ts->total_io_u[ddir]) / runt; } json_object_add_value_int(dir_object, "io_bytes", ts->io_bytes[ddir]); json_object_add_value_int(dir_object, "io_kbytes", ts->io_bytes[ddir] >> 10); + json_object_add_value_int(dir_object, "bw_bytes", bw_bytes); json_object_add_value_int(dir_object, "bw", bw); json_object_add_value_float(dir_object, "iops", iops); json_object_add_value_int(dir_object, "runtime", ts->runtime[ddir]); -- 2.25.1