Fix 'min' latency times being 0 with ramp_time
authorJens Axboe <axboe@kernel.dk>
Fri, 14 Dec 2018 21:36:52 +0000 (14:36 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 14 Dec 2018 21:36:52 +0000 (14:36 -0700)
If the job includes a ramp_time setting, we end up with latencies
that look like this:

    slat (nsec): min=0, max=17585, avg=1896.34, stdev=733.35
    clat (nsec): min=0, max=1398.1k, avg=77851.76, stdev=25055.97
     lat (nsec): min=0, max=1406.1k, avg=79824.20, stdev=25066.57

with the 'min' being 0. This is because the reset stats sets the
field to zero, and no new IO will be smaller than that...

Set the min value to the max value of the type when we reset stats.

Reported-by: Matthew Eaton <m.eaton82@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat.c

diff --git a/stat.c b/stat.c
index ec75de241be623756c88c1b88edb69473a0dfb97..351c49cc4f720024a7b500b525e9a32657e65299 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -2351,7 +2351,8 @@ static void __add_log_sample(struct io_log *iolog, union io_sample_data data,
 
 static inline void reset_io_stat(struct io_stat *ios)
 {
-       ios->max_val = ios->min_val = ios->samples = 0;
+       ios->min_val = -1ULL;
+       ios->max_val = ios->samples = 0;
        ios->mean.u.f = ios->S.u.f = 0;
 }