[PATCH] Fix sum_stat() bug in group_reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Write samples in io_stat does not be counted with rw=randread, vice versa.
Then, in sum_stat() function, it will cause 0/0 in calculating mean and S,
and 'nan' is printed. So it should return immediately when src->samples is
equal to 0.

the configuration file used:

[global]
direct=1
ioengine=psync
bs=4k
filename=/dev/sdb1
runtime=5
group_reporting
loops=50

[read]
rw=randread
numjobs=8

[write]
rw=randwrite
numjobs=8

CC: Jens Axboe <jens.axboe@xxxxxxxxxx>
CC: Yu-ju Hong <yjhong@xxxxxxxxxx>
Signed-off-by: Zheng Liu <wenqing.lz@xxxxxxxxxx>
---
 stat.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/stat.c b/stat.c
index d2cc775..3662fd9 100644
--- a/stat.c
+++ b/stat.c
@@ -618,6 +618,9 @@ static void sum_stat(struct io_stat *dst, struct io_stat *src, int nr)
 {
     double mean, S;

+    if (src->samples == 0)
+        return;
+
     dst->min_val = min(dst->min_val, src->min_val);
     dst->max_val = max(dst->max_val, src->max_val);

--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Home]     [Linux SCSI]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Video Projectors]     [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Powered by Linux