Merge branch 'perf-Avoid_Clock_Check_For_No_Rate_Check' of https://github.com/horshac...
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 8035f4b725fc13b64be0c11aa5b45853e19a7982..eb617e649c1df82dba42259361cd36f3a32e7796 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -785,7 +785,15 @@ static enum fio_ddir get_rw_ddir(struct thread_data *td)
        else
                ddir = DDIR_INVAL;
 
-       td->rwmix_ddir = rate_ddir(td, ddir);
+       if (!should_check_rate(td)) {
+               /*
+                * avoid time-consuming call to utime_since_now() if rate checking
+                * isn't being used. this imrpoves IOPs 50%. See:
+                * https://github.com/axboe/fio/issues/1501#issuecomment-1418327049
+                */
+               td->rwmix_ddir = ddir;
+       } else
+               td->rwmix_ddir = rate_ddir(td, ddir);
        return td->rwmix_ddir;
 }