From: Jens Axboe Date: Tue, 19 Dec 2017 17:17:41 +0000 (-0700) Subject: backend: tweaks to missed rate thinktime X-Git-Tag: fio-3.3~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=62b858f646ad4fce971fbde21ff4859ec84bc281;ds=sidebyside backend: tweaks to missed rate thinktime shimrot says: "May I suggest a tweak to the backend.c::handle_thinktime calculation of "over"? That is, adjust based on the rate per byte similar to what you've done. That is, if thinktime is greater than one op worth of bytes, then subtract one op worth of bytes. But, if think time is greater than one ops worth, instead add the missing the number of bytes a full op would have exceeded the think time." See: https://github.com/axboe/fio/issues/497#issuecomment-352816955 Signed-off-by: Jens Axboe --- diff --git a/backend.c b/backend.c index e248117f..b4a09aca 100644 --- a/backend.c +++ b/backend.c @@ -899,12 +899,14 @@ static void handle_thinktime(struct thread_data *td, enum fio_ddir ddir) */ if (total && td->rate_bps[ddir] && td->o.rate_ign_think) { uint64_t missed = (td->rate_bps[ddir] * total) / 1000000ULL; + uint64_t bs = td->o.min_bs[ddir]; + uint64_t usperop = bs * 1000000ULL / td->rate_bps[ddir]; uint64_t over; - if (total >= 1000000) - over = td->o.min_bs[ddir]; + if (usperop <= total) + over = bs; else - over = (td->o.min_bs[ddir] * total) / 1000000ULL; + over = (usperop - total) / usperop * -bs; td->rate_io_issue_bytes[ddir] += (missed - over); }