summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-03-21 12:23:13 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:35:55 -0400
commit534466754f381e90f5f6475a0c02031242a5c256 (patch)
treebac4629fa909493aec359051c76fcb4600bcc934 /src/common
parentARM/WaitTree: Better track the CallStack for each thread. (diff)
downloadyuzu-534466754f381e90f5f6475a0c02031242a5c256.tar.gz
yuzu-534466754f381e90f5f6475a0c02031242a5c256.tar.xz
yuzu-534466754f381e90f5f6475a0c02031242a5c256.zip
X64 Clock: Reduce accuracy to be less or equal to guest accuracy.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/x64/native_clock.cpp3
-rw-r--r--src/common/x64/native_clock.h5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index 926f92ff8..f1bc60fd2 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -62,7 +62,8 @@ u64 NativeClock::GetRTSC() {
62 } 62 }
63 accumulated_ticks += diff; 63 accumulated_ticks += diff;
64 rtsc_serialize.unlock(); 64 rtsc_serialize.unlock();
65 return accumulated_ticks; 65 /// The clock cannot be more precise than the guest timer, remove the lower bits
66 return accumulated_ticks & inaccuracy_mask;
66} 67}
67 68
68void NativeClock::Pause(bool is_paused) { 69void NativeClock::Pause(bool is_paused) {
diff --git a/src/common/x64/native_clock.h b/src/common/x64/native_clock.h
index 3851f8fc2..e853094d2 100644
--- a/src/common/x64/native_clock.h
+++ b/src/common/x64/native_clock.h
@@ -31,6 +31,11 @@ public:
31private: 31private:
32 u64 GetRTSC(); 32 u64 GetRTSC();
33 33
34 /// value used to reduce the native clocks accuracy as some apss rely on
35 /// undefined behavior where the level of accuracy in the clock shouldn't
36 /// be higher.
37 static constexpr u64 inaccuracy_mask = ~(0x100 - 1);
38
34 SpinLock rtsc_serialize{}; 39 SpinLock rtsc_serialize{};
35 u64 last_measure{}; 40 u64 last_measure{};
36 u64 accumulated_ticks{}; 41 u64 accumulated_ticks{};