configure: don't override march if already set
[fio.git] / backend.c
index 5304ddc0ae1df0245405d2f6136c1b45755473d2..b4a09acae5ab0e2ccc2515a5b1251342f1dc34d9 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -898,8 +898,17 @@ static void handle_thinktime(struct thread_data *td, enum fio_ddir ddir)
         * 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;
-               td->rate_io_issue_bytes[ddir] -= td->o.min_bs[ddir];
+               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);
        }
 }