From 306fea38fa61c305703d0269b1fc8e7da3b91a1f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 25 Apr 2017 18:14:00 -0600 Subject: [PATCH] stat: make next log time decision cleaner Signed-off-by: Jens Axboe --- stat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stat.c b/stat.c index fde7af29..27d1feac 100644 --- a/stat.c +++ b/stat.c @@ -2479,9 +2479,10 @@ static int add_bw_samples(struct thread_data *td, struct timeval *t) td_io_u_unlock(td); if (spent <= td->o.bw_avg_time) - return min(next_log, td->o.bw_avg_time); + next = td->o.bw_avg_time; + else + next = td->o.bw_avg_time - (1 + spent - td->o.bw_avg_time); - next = td->o.bw_avg_time - (1 + spent - td->o.bw_avg_time); return min(next, next_log); } @@ -2554,9 +2555,10 @@ static int add_iops_samples(struct thread_data *td, struct timeval *t) td_io_u_unlock(td); if (spent <= td->o.iops_avg_time) - return min(next_log, td->o.iops_avg_time); + next = td->o.iops_avg_time; + else + next = td->o.iops_avg_time - (1 + spent - td->o.iops_avg_time); - next = td->o.iops_avg_time - (1 + spent - td->o.iops_avg_time); return min(next, next_log); } -- 2.25.1