summaryrefslogtreecommitdiffstats
path: root/src/common/x64
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-25 17:28:55 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:10 +0200
commit18dcb0934217628711c5b1d22fd6d7635e683e3f (patch)
tree426f78eb11aa79e0d1c7470b966fbae8ea8e3e6d /src/common/x64
parentAudioCore: Use nanoseconds instead of cycles for buffer time. (diff)
downloadyuzu-18dcb0934217628711c5b1d22fd6d7635e683e3f.tar
yuzu-18dcb0934217628711c5b1d22fd6d7635e683e3f.tar.gz
yuzu-18dcb0934217628711c5b1d22fd6d7635e683e3f.tar.bz2
yuzu-18dcb0934217628711c5b1d22fd6d7635e683e3f.tar.lz
yuzu-18dcb0934217628711c5b1d22fd6d7635e683e3f.tar.xz
yuzu-18dcb0934217628711c5b1d22fd6d7635e683e3f.tar.zst
yuzu-18dcb0934217628711c5b1d22fd6d7635e683e3f.zip
Diffstat (limited to 'src/common/x64')
-rw-r--r--src/common/x64/native_clock.cpp7
-rw-r--r--src/common/x64/native_clock.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index 26d4d0ba6..926f92ff8 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -65,6 +65,13 @@ u64 NativeClock::GetRTSC() {
return accumulated_ticks;
}
+void NativeClock::Pause(bool is_paused) {
+ if (!is_paused) {
+ _mm_mfence();
+ last_measure = __rdtsc();
+ }
+}
+
std::chrono::nanoseconds NativeClock::GetTimeNS() {
const u64 rtsc_value = GetRTSC();
return std::chrono::nanoseconds{MultiplyAndDivide64(rtsc_value, 1000000000, rtsc_frequency)};
diff --git a/src/common/x64/native_clock.h b/src/common/x64/native_clock.h
index b58cf9f5a..3851f8fc2 100644
--- a/src/common/x64/native_clock.h
+++ b/src/common/x64/native_clock.h
@@ -26,6 +26,8 @@ public:
u64 GetCPUCycles() override;
+ void Pause(bool is_paused) override;
+
private:
u64 GetRTSC();