X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=gettime.c;h=533ec97b50b6e9c1baf84e82a012090a06214be2;hp=c691113e9ad85365999d942aff8d99415101be31;hb=8a7bd8773ceb3202690f2de4a9cd0e738b5a6edc;hpb=f5cc024a0ab9f51b1cb9fcd980b85199bdf011b0 diff --git a/gettime.c b/gettime.c index c691113e..533ec97b 100644 --- a/gettime.c +++ b/gettime.c @@ -101,36 +101,30 @@ static void fio_init gtod_init(void) #endif /* FIO_DEBUG_TIME */ +#ifdef FIO_DEBUG_TIME void fio_gettime(struct timeval *tp, void *caller) +#else +void fio_gettime(struct timeval *tp, void fio_unused *caller) +#endif { #ifdef FIO_DEBUG_TIME if (!caller) caller = __builtin_return_address(0); gtod_log_caller(caller); -#else - caller = NULL; #endif -repeat: - if (!clock_gettime_works) + if (!clock_gettime_works) { +gtod: gettimeofday(tp, NULL); - else { + } else { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) { clock_gettime_works = 0; - goto repeat; + goto gtod; } tp->tv_sec = ts.tv_sec; tp->tv_usec = ts.tv_nsec / 1000; } } - -static void fio_init check_clock(void) -{ - struct timespec ts; - - if (clock_getres(CLOCK_MONOTONIC, &ts) < 0) - clock_gettime_works = 0; -}