aboutsummaryrefslogtreecommitdiff
path: root/src/common/wall_clock.cpp
diff options
context:
space:
mode:
authorMarshall Mohror <mohror64@gmail.com>2022-07-06 12:42:01 -0500
committerMarshall Mohror <mohror64@gmail.com>2022-07-06 12:42:01 -0500
commitb37f669584455dac5ccd108eaab0facd6686e385 (patch)
treed290710b8975e063db7c38ef497e46cfdc71301f /src/common/wall_clock.cpp
parentbbc368882c7052e28f3cd510f0e1bc0481703b1c (diff)
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.
Diffstat (limited to 'src/common/wall_clock.cpp')
-rw-r--r--src/common/wall_clock.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/wall_clock.cpp b/src/common/wall_clock.cpp
index b4fb3a59f0..ae07f28116 100644
--- a/src/common/wall_clock.cpp
+++ b/src/common/wall_clock.cpp
@@ -67,7 +67,7 @@ std::unique_ptr<WallClock> 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: