[Base] Don't use raw clock where unsupported

This commit is contained in:
Triang3l 2021-09-13 23:13:02 +03:00
parent 7aeac37eb6
commit f91b895c9a
3 changed files with 17 additions and 6 deletions

View File

@ -109,18 +109,20 @@ inline uint64_t QueryGuestSystemTimeOffset() {
}
uint64_t Clock::QueryHostTickFrequency() {
#if XE_CLOCK_RAW_AVAILABLE
if (cvars::clock_source_raw) {
return host_tick_frequency_raw();
} else {
return host_tick_frequency_platform();
}
#endif
return host_tick_frequency_platform();
}
uint64_t Clock::QueryHostTickCount() {
#if XE_CLOCK_RAW_AVAILABLE
if (cvars::clock_source_raw) {
return host_tick_count_raw();
} else {
return host_tick_count_platform();
}
#endif
return host_tick_count_platform();
}
double Clock::guest_time_scalar() { return guest_time_scalar_; }

View File

@ -13,6 +13,11 @@
#include <cstdint>
#include "xenia/base/cvar.h"
#include "xenia/base/platform.h"
#if XE_ARCH_AMD64
#define XE_CLOCK_RAW_AVAILABLE 1
#endif
DECLARE_bool(clock_no_scaling);
DECLARE_bool(clock_source_raw);
@ -24,10 +29,14 @@ class Clock {
// Host ticks-per-second. Generally QueryHostTickFrequency should be used.
// Either from platform suplied time source or from hardware directly.
static uint64_t host_tick_frequency_platform();
#if XE_CLOCK_RAW_AVAILABLE
static uint64_t host_tick_frequency_raw();
#endif
// Host tick count. Generally QueryHostTickCount() should be used.
static uint64_t host_tick_count_platform();
#if XE_CLOCK_RAW_AVAILABLE
static uint64_t host_tick_count_raw();
#endif
// Queries the host tick frequency.
static uint64_t QueryHostTickFrequency();

View File

@ -7,11 +7,11 @@
******************************************************************************
*/
#include "xenia/base/clock.h"
#include "xenia/base/platform.h"
#if XE_ARCH_AMD64
#if XE_ARCH_AMD64 && XE_CLOCK_RAW_AVAILABLE
#include "xenia/base/clock.h"
#include "xenia/base/logging.h"
// Wrap all these different cpu compiler intrinsics.