+int in_ramp_time(struct thread_data *td)
+{
+ return td->o.ramp_time && !td->ramp_time_over;
+}
+
+int ramp_time_over(struct thread_data *td)
+{
+ struct timeval tv;
+
+ if (!td->o.ramp_time || td->ramp_time_over)
+ return 1;
+
+ fio_gettime(&tv, NULL);
+ if (mtime_since(&td->epoch, &tv) >= td->o.ramp_time * 1000) {
+ td->ramp_time_over = 1;
+ reset_all_stats(td);
+ td_set_runstate(td, TD_RAMP);
+ return 1;
+ }
+
+ return 0;
+}
+
+static void fio_init time_init(void)
+{
+ int i;
+
+ /*
+ * Check the granularity of the nanosleep function
+ */
+ for (i = 0; i < 10; i++) {
+ struct timeval tv;
+ struct timespec ts;
+ unsigned long elapsed;
+
+ fio_gettime(&tv, NULL);
+ ts.tv_sec = 0;
+ ts.tv_nsec = 1000;
+
+ nanosleep(&ts, NULL);
+ elapsed = utime_since_now(&tv);
+
+ if (elapsed > ns_granularity)
+ ns_granularity = elapsed;
+ }
+}
+
+void set_genesis_time(void)