aaaaaaaaaaaaaarm

This commit is contained in:
lizzie 2026-05-24 02:01:24 +00:00
parent 33f6f5bba3
commit bf6d92f845
3 changed files with 3 additions and 12 deletions

View file

@ -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 {}

View file

@ -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

View file

@ -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