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
parent 657ab0287d
commit c3fbc8d2fe
4 changed files with 22 additions and 5 deletions

View file

@ -131,6 +131,10 @@ public:
/// Checks for events manually and returns time in nanoseconds for next event, threadsafe.
std::optional<s64> Advance();
#ifdef _WIN32
void SetTimerResolutionNs(std::chrono::nanoseconds ns);
#endif
private:
struct Event;
@ -143,6 +147,10 @@ private:
s64 global_timer = 0;
#ifdef _WIN32
s64 timer_resolution_ns;
#endif
// The queue is a min-heap using std::make_heap/push_heap/pop_heap.
// We don't use std::priority_queue because we need to be able to serialize, unserialize and
// erase arbitrary events (RemoveEvent()) regardless of the queue order. These aren't