commit | 44aab35f7b67302c3bd67f704cc4d6f847da0f27 | [log] [tgz] |
---|---|---|
author | Jens Axboe <axboe@fb.com> | Tue Nov 11 08:09:04 2014 -0700 |
committer | Mohamad Ayyash <mkayyash@google.com> | Fri Mar 06 17:58:03 2015 -0800 |
tree | 6f1bf24bef2126db9e51a004afc63601bf84dc81 | |
parent | 93d36583037075082fe1d34b065e7f8116cfa17f [diff] |
t/btrace2fio: fix divide-by-zero in rate calculation If usec is less than 1000, it'd crash. Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/t/btrace2fio.c b/t/btrace2fio.c index bf67ed0..efe25c4 100644 --- a/t/btrace2fio.c +++ b/t/btrace2fio.c
@@ -549,8 +549,12 @@ if (!usec) return 0; + usec /= 1000; + if (!usec) + return 0; + val = o->kb[rw] * 1000ULL; - return val / (usec / 1000ULL); + return val / usec; } static uint64_t o_first_ttime(struct btrace_out *o)