[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/eta.c b/eta.c
index 339f656..99e59ec 100644
--- a/eta.c
+++ b/eta.c
@@ -238,7 +238,7 @@
if (mtime > 1000) {
r_rate = (io_bytes[0] - prev_io_bytes[0]) / mtime;
w_rate = (io_bytes[1] - prev_io_bytes[1]) / mtime;
- gettimeofday(&prev_time, NULL);
+ fio_gettime(&prev_time, NULL);
memcpy(prev_io_bytes, io_bytes, sizeof(io_bytes));
}