clock: ensure that we re-init if the clocksource changes from the default
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/gettime.c b/gettime.c
index 1ba18e9..9f23e3f 100644
--- a/gettime.c
+++ b/gettime.c
@@ -22,6 +22,7 @@
enum fio_cs fio_clock_source = FIO_PREFERRED_CLOCK_SOURCE;
int fio_clock_source_set = 0;
+enum fio_cs fio_clock_source_inited = CS_INVAL;
#ifdef FIO_DEBUG_TIME
@@ -262,7 +263,11 @@
void fio_clock_init(void)
{
+ if (fio_clock_source == fio_clock_source_inited)
+ return;
+
last_tv_valid = 0;
+ fio_clock_source_inited = fio_clock_source;
calibrate_cpu_clock();
/*