#include "fio.h"
+static struct timeval genesis;
+
unsigned long utime_since(struct timeval *s, struct timeval *e)
{
double sec, usec;
/*
* busy looping version for the last few usec
*/
-static void __usec_sleep(unsigned int usec)
+void __usec_sleep(unsigned int usec)
{
struct timeval start;
}
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;
- 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;
td->rate_pending_usleep -= overtime;
}
}
+
+unsigned long mtime_since_genesis(void)
+{
+ return mtime_since_now(&genesis);
+}
+
+void time_init(void)
+{
+ gettimeofday(&genesis, NULL);
+}
+
+void fill_start_time(struct timeval *t)
+{
+ memcpy(t, &genesis, sizeof(genesis));
+}