summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-06-19 17:41:15 +0800
committerErik Kundiman <erik@megapahit.org>2025-06-19 17:41:15 +0800
commit1e2c621af65cd1bde8ad122be4d4a6d4bb578f25 (patch)
treeea8da471d97f03cbd4a5607484e1f908f52a302c
parent1b3041f3d8e09257a5fb90786adbe48bc0304a79 (diff)
Alternative to rdtsc, for Windows arm64
Just copying from this: https://forum.juce.com/t/windows-arm64-support/47572/6 This commit is for getting rid of the compile error for now, we don't know yet if this will work correctly or not.
-rw-r--r--indra/llcommon/llfasttimer.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index a69a03e419..8499655bfa 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -99,7 +99,11 @@ public:
#if LL_FASTTIMER_USE_RDTSC
static U32 getCPUClockCount32()
{
+#if _M_ARM64
+ unsigned __int64 val = _ReadStatusReg(ARM64_PMCCNTR_EL0);
+#else
unsigned __int64 val = __rdtsc();
+#endif
val = val >> 8;
return static_cast<U32>(val);
}
@@ -107,7 +111,11 @@ public:
// return full timer value, *not* shifted by 8 bits
static U64 getCPUClockCount64()
{
+#if _M_ARM64
+ return static_cast<U64>( _ReadStatusReg(ARM64_PMCCNTR_EL0) );
+#else
return static_cast<U64>( __rdtsc() );
+#endif
}
#else