#include "fio.h"
#include "smalloc.h"
-struct timeval *fio_tv;
+struct timeval *fio_tv = NULL;
int fio_gtod_offload = 0;
int fio_gtod_cpu = -1;
static pthread_t gtod_thread;
static void fio_gtod_update(void)
{
- if (fio_tv)
- gettimeofday(fio_tv, NULL);
+ if (fio_tv) {
+ struct timeval __tv;
+
+ gettimeofday(&__tv, NULL);
+ fio_tv->tv_sec = __tv.tv_sec;
+ write_barrier();
+ fio_tv->tv_usec = __tv.tv_usec;
+ write_barrier();
+ }
}
static void *gtod_thread_main(void *data)