Allow configurable ETA intervals
[fio.git] / backend.c
index 69f03dcf4919bd7f6fae839bf8de36d7e613ac15..e248117f20624846dbfac614abe7204ca3259807 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -894,10 +894,20 @@ 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 over;
+
+               if (total >= 1000000)
+                       over = td->o.min_bs[ddir];
+               else
+                       over = (td->o.min_bs[ddir] * total) / 1000000ULL;
+
+               td->rate_io_issue_bytes[ddir] += (missed - over);
+       }
 }
 
 /*