projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b295dc2
)
t/btrace2fio: fix divide-by-zero in rate calculation
author
Jens Axboe
<axboe@fb.com>
Tue, 11 Nov 2014 15:09:04 +0000
(08:09 -0700)
committer
Jens Axboe
<axboe@fb.com>
Tue, 11 Nov 2014 15:09:04 +0000
(08:09 -0700)
If usec is less than 1000, it'd crash.
Signed-off-by: Jens Axboe <axboe@fb.com>
t/btrace2fio.c
patch
|
blob
|
blame
|
history
diff --git
a/t/btrace2fio.c
b/t/btrace2fio.c
index bf67ed0a183ac5cbd08854087e068f37355d399b..efe25c4c1100b394bc317ad808a575b0a59556fd 100644
(file)
--- a/
t/btrace2fio.c
+++ b/
t/btrace2fio.c
@@
-546,11
+546,15
@@
static unsigned long o_to_kb_rate(struct btrace_out *o, int rw)
uint64_t usec = (o->last_ttime[rw] - o->first_ttime[rw]) / 1000ULL;
uint64_t val;
+ 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)