projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b161009
)
[PATCH] Fix division by zero in deviance calculation
author
Jens Axboe
<jens.axboe@oracle.com>
Wed, 3 Jan 2007 10:10:27 +0000
(11:10 +0100)
committer
Jens Axboe
<jens.axboe@oracle.com>
Wed, 3 Jan 2007 10:10:27 +0000
(11:10 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
stat.c
patch
|
blob
|
blame
|
history
diff --git
a/stat.c
b/stat.c
index b4facc7eab4da21a71ff7f343f7e2f264ab9ea40..6e55925b1cf288ebadc565a4d4c506248ed22b9e 100644
(file)
--- a/
stat.c
+++ b/
stat.c
@@
-281,8
+281,12
@@
static int calc_lat(struct io_stat *is, unsigned long *min, unsigned long *max,
n = (double) is->samples;
*mean = (double) is->val / n;
- *dev = sqrt(((double) is->val_sq - (*mean * *mean) / n) / (n - 1));
+ *dev = 0;
+
+ if (n <= 1)
+ return 1;
+ *dev = sqrt(((double) is->val_sq - (*mean * *mean) / n) / (n - 1));
return 1;
}