From: Jens Axboe Date: Wed, 26 Apr 2017 00:14:00 +0000 (-0600) Subject: stat: make next log time decision cleaner X-Git-Tag: fio-2.20~45 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=306fea38fa61c305703d0269b1fc8e7da3b91a1f stat: make next log time decision cleaner Signed-off-by: Jens Axboe --- 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); }