core_timing: Remove GetCurrentTimerResolution in CoreTiming loop

Other programs may change this value, but if thousands of syscalls in this loop is undesirable, then we can just set this once.
This commit is contained in:
Morph 2023-07-02 15:05:35 -04:00
commit c3fbc8d2fe

View file

@ -253,9 +253,6 @@ void CoreTiming::ThreadLoop() {
auto wait_time = *next_time - GetGlobalTimeNs().count();
if (wait_time > 0) {
#ifdef _WIN32
const auto timer_resolution_ns =
Common::Windows::GetCurrentTimerResolution().count();
while (!paused && !event.IsSet() && wait_time > 0) {
wait_time = *next_time - GetGlobalTimeNs().count();
@ -316,4 +313,10 @@ std::chrono::microseconds CoreTiming::GetGlobalTimeUs() const {
return std::chrono::microseconds{Common::WallClock::CPUTickToUS(cpu_ticks)};
}
#ifdef _WIN32
void CoreTiming::SetTimerResolutionNs(std::chrono::nanoseconds ns) {
timer_resolution_ns = ns.count();
}
#endif
} // namespace Core::Timing