X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=backend.c;h=b4a09acae5ab0e2ccc2515a5b1251342f1dc34d9;hp=69f03dcf4919bd7f6fae839bf8de36d7e613ac15;hb=9f75af77ea4b13cd44e5246426dbdbceff22f27c;hpb=1a9bf8146d9842d268bcb01f4286325a8cfccc21 diff --git a/backend.c b/backend.c index 69f03dcf..b4a09aca 100644 --- a/backend.c +++ b/backend.c @@ -894,10 +894,22 @@ static void handle_thinktime(struct thread_data *td, enum fio_ddir ddir) /* * If we're ignoring thinktime for the rate, add the number of bytes - * we would have done while sleeping. + * we would have done while sleeping, minus one block to ensure we + * start issuing immediately after the sleep. */ - if (total && td->rate_bps[ddir] && td->o.rate_ign_think) - td->rate_io_issue_bytes[ddir] += (td->rate_bps[ddir] * 1000000) / total; + 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 (usperop <= total) + over = bs; + else + over = (usperop - total) / usperop * -bs; + + td->rate_io_issue_bytes[ddir] += (missed - over); + } } /*