summaryrefslogtreecommitdiff
path: root/gettime.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-12-14 20:37:06 +0100
committerJens Axboe <axboe@kernel.dk>2012-12-14 20:37:06 +0100
commit01423eae85a071ff6acee870edd696c7929723ba (patch)
tree6ee629a3ddbafc01b4a030066162af194ae1489b /gettime.c
parent84b3842c7373268d62d2be26c3af28707f91c98c (diff)
downloadfio-01423eae85a071ff6acee870edd696c7929723ba.tar.gz
fio-01423eae85a071ff6acee870edd696c7929723ba.tar.bz2
clock: ensure that we re-init if the clocksource changes from the default
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'gettime.c')
-rw-r--r--gettime.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gettime.c b/gettime.c
index 1ba18e99..9f23e3ff 100644
--- a/gettime.c
+++ b/gettime.c
@@ -22,6 +22,7 @@ static int last_tv_valid;
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 @@ static void calibrate_cpu_clock(void)
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();
/*