From b2ad4dd189135be9a87af86619d6f5854525f7fa Mon Sep 17 00:00:00 2001 From: Marshall Mohror Date: Wed, 6 Jul 2022 12:42:01 -0500 Subject: common/x64: Use TSC clock rate from CPUID when available The current method used to estimate the TSC is fairly accurate - within a few kHz - but the exact value can be extracted from CPUID if available. --- src/common/wall_clock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/wall_clock.cpp') diff --git a/src/common/wall_clock.cpp b/src/common/wall_clock.cpp index b4fb3a59f..ae07f2811 100644 --- a/src/common/wall_clock.cpp +++ b/src/common/wall_clock.cpp @@ -67,7 +67,7 @@ std::unique_ptr CreateBestMatchingClock(u64 emulated_cpu_frequency, const auto& caps = GetCPUCaps(); u64 rtsc_frequency = 0; if (caps.invariant_tsc) { - rtsc_frequency = EstimateRDTSCFrequency(); + rtsc_frequency = caps.tsc_frequency ? caps.tsc_frequency : EstimateRDTSCFrequency(); } // Fallback to StandardWallClock if the hardware TSC does not have the precision greater than: -- cgit v1.2.3