From 78c1eda5486f586ca73e9cbe7e40b93fccdbd218 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 30 Aug 2011 15:34:14 -0600 Subject: [PATCH 1/1] Fix bad latency reporting for rated IO jobs If we are going to sleep to satisfy a given rate limit, then ensure that we flush pending IO first. Otherwise they end up including the sleep time in the calculated completion latencies. Signed-off-by: Jens Axboe --- io_u.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/io_u.c b/io_u.c index 6a53bdaa..7709df5f 100644 --- a/io_u.c +++ b/io_u.c @@ -486,6 +486,16 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir) } else usec = td->rate_pending_usleep[ddir]; + /* + * We are going to sleep, ensure that we flush anything pending as + * not to skew our latency numbers + */ + if (td->cur_depth) { + int fio_unused ret; + + ret = io_u_queued_complete(td, td->cur_depth, NULL); + } + fio_gettime(&t, NULL); usec_sleep(td, usec); usec = utime_since_now(&t); -- 2.25.1