Fix sum_stat() bug in group_reporting
authorZheng Liu <wenqing.lz@taobao.com>
Fri, 16 Sep 2011 06:20:12 +0000 (08:20 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 16 Sep 2011 06:20:12 +0000 (08:20 +0200)
commite09231c214906b4ff8cbc3dc202c39755fbf6afd
tree0b22f235c35cfd0ba578c01bd548c946eb4fd592
parent836bad52fff2a882e857a52ba94ac0eae6222587
Fix sum_stat() bug in group_reporting

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 error result is as follows:
  write: io=8328.0KB, bw=1582.7KB/s, iops=395 , runt=  5262msec
    clat (usec): min=58 , max=293353 , avg= -nan, stdev= -nan
     lat (usec): min=59 , max=293353 , avg= -nan, stdev= -nan
    bw (KB/s) : min=   92, max=  804, per=-nan%, avg= -nan, stdev= -nan

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 <jaxboe@fusionio.com>
CC: Yu-ju Hong <yjhong@google.com>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat.c