From 1a441222ca153da08c4f00270539b8e7a1b2c26a Mon Sep 17 00:00:00 2001 From: lizzie Date: Sun, 24 May 2026 02:01:24 +0000 Subject: [PATCH] aaaaaaaaaaaaaarm --- src/common/cpu_features.cpp | 3 ++- src/common/cpu_features.h | 1 + src/common/thread.cpp | 11 ----------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/common/cpu_features.cpp b/src/common/cpu_features.cpp index bb1c7c8577..064240c404 100644 --- a/src/common/cpu_features.cpp +++ b/src/common/cpu_features.cpp @@ -351,6 +351,7 @@ WallClock::WallClock(bool invariant_, u64 rdtsc_frequency_) noexcept { ns_cntfrq_factor = GetFixedPointFactor(NsRatio::den, host_cntfrq); us_cntfrq_factor = GetFixedPointFactor(UsRatio::den, host_cntfrq); ms_cntfrq_factor = GetFixedPointFactor(MsRatio::den, host_cntfrq); + cntfrq_ns_factor = GetFixedPointFactor(host_cntfrq, NsRatio::den); guest_cntfrq_factor = GetFixedPointFactor(CNTFRQ, host_cntfrq); gputick_cntfrq_factor = GetFixedPointFactor(GPUTickFreq, host_cntfrq); } @@ -391,7 +392,7 @@ bool WallClock::IsNative() const { } u64 WallClock::NsToTicks(std::chrono::nanoseconds ns) const { - return ns; + return MultiplyHigh(ns.count(), cntfrq_ns_factor); } #else WallClock::WallClock(bool invariant_, u64 rdtsc_frequency_) noexcept {} diff --git a/src/common/cpu_features.h b/src/common/cpu_features.h index 9655af3ee6..7dcb550f8f 100644 --- a/src/common/cpu_features.h +++ b/src/common/cpu_features.h @@ -108,6 +108,7 @@ public: FactorType ns_cntfrq_factor; FactorType us_cntfrq_factor; FactorType ms_cntfrq_factor; + FactorType cntfrq_ns_factor; FactorType guest_cntfrq_factor; FactorType gputick_cntfrq_factor; #endif diff --git a/src/common/thread.cpp b/src/common/thread.cpp index d53ba59131..08b266254c 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -231,22 +231,11 @@ bool Event::WaitFor(const std::chrono::nanoseconds time) { } #else bool Event::WaitFor(const std::chrono::nanoseconds time) { -#ifdef _WIN32 - s64 rem = s64(time.count()); //98 years - while (!is_set.load() && rem > 0) { - Common::Windows::SleepForOneTick(); - rem = s64(Common::g_wall_clock.GetGlobalTimeNs().count()) - s64(time.count()); - } - if (is_set.load()) - Reset(); - return true; -#else std::unique_lock lk{mutex}; if (!condvar.wait_for(lk, time, [this] { return is_set.load(); })) return false; is_set = false; return true; -#endif } #endif