[PATCH] Add in-progress io rate
[fio.git] / time.c
diff --git a/time.c b/time.c
index ad5ee3fe51773c9019067f593834428afad8fc9b..d08c791673f55b8139be5ec20cc757a891913423 100644 (file)
--- a/time.c
+++ b/time.c
@@ -99,14 +99,14 @@ void usec_sleep(struct thread_data *td, unsigned long usec)
 }
 
 void rate_throttle(struct thread_data *td, unsigned long time_spent,
 }
 
 void rate_throttle(struct thread_data *td, unsigned long time_spent,
-                  unsigned int bytes)
+                  unsigned int bytes, int ddir)
 {
        unsigned long usec_cycle;
 
        if (!td->rate)
                return;
 
 {
        unsigned long usec_cycle;
 
        if (!td->rate)
                return;
 
-       usec_cycle = td->rate_usec_cycle * (bytes / td->min_bs);
+       usec_cycle = td->rate_usec_cycle * (bytes / td->min_bs[ddir]);
 
        if (time_spent < usec_cycle) {
                unsigned long s = usec_cycle - time_spent;
 
        if (time_spent < usec_cycle) {
                unsigned long s = usec_cycle - time_spent;
@@ -132,3 +132,8 @@ void time_init(void)
 {
        gettimeofday(&genesis, NULL);
 }
 {
        gettimeofday(&genesis, NULL);
 }
+
+void fill_start_time(struct timeval *t)
+{
+       memcpy(t, &genesis, sizeof(genesis));
+}