mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-01 22:57:08 +02:00
aaaaaaaaaaaaaarm
This commit is contained in:
parent
aa853f0786
commit
1a441222ca
3 changed files with 3 additions and 12 deletions
|
|
@ -351,6 +351,7 @@ WallClock::WallClock(bool invariant_, u64 rdtsc_frequency_) noexcept {
|
||||||
ns_cntfrq_factor = GetFixedPointFactor(NsRatio::den, host_cntfrq);
|
ns_cntfrq_factor = GetFixedPointFactor(NsRatio::den, host_cntfrq);
|
||||||
us_cntfrq_factor = GetFixedPointFactor(UsRatio::den, host_cntfrq);
|
us_cntfrq_factor = GetFixedPointFactor(UsRatio::den, host_cntfrq);
|
||||||
ms_cntfrq_factor = GetFixedPointFactor(MsRatio::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);
|
guest_cntfrq_factor = GetFixedPointFactor(CNTFRQ, host_cntfrq);
|
||||||
gputick_cntfrq_factor = GetFixedPointFactor(GPUTickFreq, 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 {
|
u64 WallClock::NsToTicks(std::chrono::nanoseconds ns) const {
|
||||||
return ns;
|
return MultiplyHigh(ns.count(), cntfrq_ns_factor);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
WallClock::WallClock(bool invariant_, u64 rdtsc_frequency_) noexcept {}
|
WallClock::WallClock(bool invariant_, u64 rdtsc_frequency_) noexcept {}
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ public:
|
||||||
FactorType ns_cntfrq_factor;
|
FactorType ns_cntfrq_factor;
|
||||||
FactorType us_cntfrq_factor;
|
FactorType us_cntfrq_factor;
|
||||||
FactorType ms_cntfrq_factor;
|
FactorType ms_cntfrq_factor;
|
||||||
|
FactorType cntfrq_ns_factor;
|
||||||
FactorType guest_cntfrq_factor;
|
FactorType guest_cntfrq_factor;
|
||||||
FactorType gputick_cntfrq_factor;
|
FactorType gputick_cntfrq_factor;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -231,22 +231,11 @@ bool Event::WaitFor(const std::chrono::nanoseconds time) {
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool Event::WaitFor(const std::chrono::nanoseconds time) {
|
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};
|
std::unique_lock lk{mutex};
|
||||||
if (!condvar.wait_for(lk, time, [this] { return is_set.load(); }))
|
if (!condvar.wait_for(lk, time, [this] { return is_set.load(); }))
|
||||||
return false;
|
return false;
|
||||||
is_set = false;
|
is_set = false;
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue