[PATCH] Time and seek optimizations

We did too many gettimeofday() calls, this patch cuts the number by
40%. Use clock_gettime() MONOTONIC instead, it is faster on my system
at least.

This patch also optimizes calling lseek() only when necessary for the
sync io engine.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/time.c b/time.c
index d08c791..cb44c20 100644
--- a/time.c
+++ b/time.c
@@ -25,7 +25,7 @@
 {
 	struct timeval t;
 
-	gettimeofday(&t, NULL);
+	fio_gettime(&t, NULL);
 	return utime_since(s, &t);
 }
 
@@ -49,8 +49,9 @@
 unsigned long mtime_since_now(struct timeval *s)
 {
 	struct timeval t;
+	void *p = __builtin_return_address(0);
 
-	gettimeofday(&t, NULL);
+	fio_gettime(&t, p);
 	return mtime_since(s, &t);
 }
 
@@ -66,7 +67,7 @@
 {
 	struct timeval start;
 
-	gettimeofday(&start, NULL);
+	fio_gettime(&start, NULL);
 	while (utime_since_now(&start) < usec)
 		nop;
 }
@@ -128,9 +129,9 @@
 	return mtime_since_now(&genesis);
 }
 
-void time_init(void)
+static void fio_init time_init(void)
 {
-	gettimeofday(&genesis, NULL);
+	fio_gettime(&genesis, NULL);
 }
 
 void fill_start_time(struct timeval *t)