From 440f88dad1edf9646856bf8ac1c1999a2d0aecc0 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 7 Sep 2020 15:55:27 -0700 Subject: [PATCH] gettime: Simplify get_cycles_per_msec() Call fio_get_mono_time() directly instead of setting fio_clock_source and calling __fio_gettime(). Signed-off-by: Bart Van Assche --- gettime.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gettime.c b/gettime.c index 6b202e8f..fcb536d0 100644 --- a/gettime.c +++ b/gettime.c @@ -239,19 +239,13 @@ static unsigned long get_cycles_per_msec(void) { struct timespec s, e; uint64_t c_s, c_e; - enum fio_cs old_cs = fio_clock_source; uint64_t elapsed; -#ifdef CONFIG_CLOCK_GETTIME - fio_clock_source = CS_CGETTIME; -#else - fio_clock_source = CS_GTOD; -#endif - __fio_gettime(&s); + fio_get_mono_time(&s); c_s = get_cpu_clock(); do { - __fio_gettime(&e); + fio_get_mono_time(&e); c_e = get_cpu_clock(); elapsed = ntime_since(&s, &e); @@ -259,7 +253,6 @@ static unsigned long get_cycles_per_msec(void) break; } while (1); - fio_clock_source = old_cs; return (c_e - c_s) * 1000000 / elapsed; } -- 2.25.1