- /*
- * If Linux is using the tsc clock on non-synced processors,
- * sometimes time can appear to drift backwards. Fix that up.
- */
- if (tv) {
- if (tv->last_tv_valid) {
- if (tp->tv_sec < tv->last_tv.tv_sec)
- tp->tv_sec = tv->last_tv.tv_sec;
- else if (tv->last_tv.tv_sec == tp->tv_sec &&
- tp->tv_usec < tv->last_tv.tv_usec)
- tp->tv_usec = tv->last_tv.tv_usec;
- }
- tv->last_tv_valid = 1;
- memcpy(&tv->last_tv, tp, sizeof(*tp));
- }
+#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);
+#endif
+ if (fio_unlikely(fio_gettime_offload(tp)))
+ return;
+
+ __fio_gettime(tp);