From 5b8f19b7afe0cabc002c453a1a4abd7a494880bb Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 14 Dec 2018 14:36:52 -0700 Subject: [PATCH] Fix 'min' latency times being 0 with ramp_time 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 Signed-off-by: Jens Axboe --- stat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stat.c b/stat.c index ec75de24..351c49cc 100644 --- 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; } -- 2.25.1