summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMerry <git@mary.rs>2022-04-03 01:13:27 +0200
committerMerry <git@mary.rs>2022-04-03 23:38:12 +0200
commit4052bfb4ada22bc922461dab09bef886e3f114ae (patch)
tree9580913d090048d961a5f9ee5feabd3968a000ee
parentnative_clock: Use lfence with rdtsc (diff)
downloadyuzu-4052bfb4ada22bc922461dab09bef886e3f114ae.tar
yuzu-4052bfb4ada22bc922461dab09bef886e3f114ae.tar.gz
yuzu-4052bfb4ada22bc922461dab09bef886e3f114ae.tar.bz2
yuzu-4052bfb4ada22bc922461dab09bef886e3f114ae.tar.lz
yuzu-4052bfb4ada22bc922461dab09bef886e3f114ae.tar.xz
yuzu-4052bfb4ada22bc922461dab09bef886e3f114ae.tar.zst
yuzu-4052bfb4ada22bc922461dab09bef886e3f114ae.zip
-rw-r--r--src/common/x64/native_clock.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index 63364f839..7fd9d22f8 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -16,15 +16,17 @@
namespace Common {
-inline u64 FencedRDTSC() {
#ifdef _MSC_VER
+__forceinline static u64 FencedRDTSC() {
_mm_lfence();
_ReadWriteBarrier();
const u64 result = __rdtsc();
_mm_lfence();
_ReadWriteBarrier();
return result;
+}
#else
+static u64 FencedRDTSC() {
u64 result;
asm volatile("lfence\n\t"
"rdtsc\n\t"
@@ -35,8 +37,8 @@ inline u64 FencedRDTSC() {
:
: "rdx", "memory", "cc");
return result;
-#endif
}
+#endif
u64 EstimateRDTSCFrequency() {
// Discard the first result measuring the rdtsc.