Rémi Bernon (@rbernon) commented about server/request.c:
+ timeout_t counter, unbiased_counter = 0; #ifdef __APPLE__ static mach_timebase_info_data_t timebase;
if (!timebase.denom) mach_timebase_info( &timebase ); - return mach_continuous_time() * timebase.numer / timebase.denom / 100; + unbiased_counter = mach_absolute_time() * timebase.numer / timebase.denom / 100; + counter = mach_continuous_time() * timebase.numer / timebase.denom / 100; #elif defined(HAVE_CLOCK_GETTIME) struct timespec ts; + if (!clock_gettime( CLOCK_MONOTONIC, &ts )) + counter = unbiased_counter = (timeout_t)ts.tv_sec * TICKS_PER_SEC + ts.tv_nsec / 100; #ifdef CLOCK_BOOTTIME if (!clock_gettime( CLOCK_BOOTTIME, &ts )) - return (timeout_t)ts.tv_sec * TICKS_PER_SEC + ts.tv_nsec / 100; + counter = (timeout_t)ts.tv_sec * TICKS_PER_SEC + ts.tv_nsec / 100; If system is suspended / resumed right between these two calls the bias gets completely off. I don't think we can make any cross-clock measurement reliable in user space, we need to use a consistent clock source across every measurement and this means Vulkan will need to have BOOTTIME clock source if we want to use BOOTTIME clock source for QPC.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9875#note_126693