Split poisson rate control into read/write/trim
[fio.git] / backend.c
index 38ef3482f85139143aca01dfea12a49ec232db19..86e689f838a00e752e8268ef6efda71fda156f00 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -811,13 +811,13 @@ static long long usec_for_io(struct thread_data *td, enum fio_ddir ddir)
                uint64_t val;
                iops = bps / td->o.bs[ddir];
                val = (int64_t) (1000000 / iops) *
                uint64_t val;
                iops = bps / td->o.bs[ddir];
                val = (int64_t) (1000000 / iops) *
-                               -logf(__rand_0_1(&td->poisson_state));
+                               -logf(__rand_0_1(&td->poisson_state[ddir]));
                if (val) {
                        dprint(FD_RATE, "poisson rate iops=%llu\n",
                                        (unsigned long long) 1000000 / val);
                }
                if (val) {
                        dprint(FD_RATE, "poisson rate iops=%llu\n",
                                        (unsigned long long) 1000000 / val);
                }
-               td->last_usec += val;
-               return td->last_usec;
+               td->last_usec[ddir] += val;
+               return td->last_usec[ddir];
        } else if (bps) {
                secs = bytes / bps;
                remainder = bytes % bps;
        } else if (bps) {
                secs = bytes / bps;
                remainder = bytes % bps;