Do diskutil check earlier
[fio.git] / time.c
diff --git a/time.c b/time.c
index ee9d33fa20d1682e6da44f72edf46023587eaee1..5755b67e78e7c71e0b33f426ea807ec19bb6f9d0 100644 (file)
--- a/time.c
+++ b/time.c
@@ -5,6 +5,7 @@
 
 static struct timeval genesis;
 static unsigned long ns_granularity;
+unsigned long long genesis_cycles;
 
 unsigned long long utime_since(struct timeval *s, struct timeval *e)
 {
@@ -122,30 +123,6 @@ void usec_sleep(struct thread_data *td, unsigned long usec)
        } while (!td->terminate);
 }
 
-long rate_throttle(struct thread_data *td, unsigned long time_spent,
-                  unsigned long bytes, enum fio_ddir ddir)
-{
-       unsigned int bs = td->o.min_bs[ddir];
-       unsigned long usec_cycle;
-
-       if (!td->o.rate[ddir] && !td->o.rate_iops[ddir])
-               return 0;
-
-       usec_cycle = td->rate_usec_cycle[ddir] * (bytes / bs);
-
-       if (time_spent < usec_cycle) {
-               unsigned long s = usec_cycle - time_spent;
-
-               td->rate_pending_usleep[ddir] += s;
-       } else {
-               long overtime = time_spent - usec_cycle;
-
-               td->rate_pending_usleep[ddir] -= overtime;
-       }
-
-       return td->rate_pending_usleep[ddir];
-}
-
 unsigned long mtime_since_genesis(void)
 {
        return mtime_since_now(&genesis);
@@ -174,10 +151,12 @@ int ramp_time_over(struct thread_data *td)
        return 0;
 }
 
-static void fio_init time_init(void)
+void fio_init fio_time_init(void)
 {
        int i;
 
+       fio_clock_init();
+
        /*
         * Check the granularity of the nanosleep function
         */
@@ -201,6 +180,7 @@ static void fio_init time_init(void)
 void set_genesis_time(void)
 {
        fio_gettime(&genesis, NULL);
+       genesis_cycles = get_cpu_clock();
 }
 
 void fill_start_time(struct timeval *t)