(wall, native)_clock: Add GetGPUTick

Allows us to directly calculate the GPU tick without double conversion to and from the host clock tick.
This commit is contained in:
Morph 2023-05-28 17:45:47 -04:00
parent 9dcc7bde8b
commit 907507886d
7 changed files with 47 additions and 12 deletions

View file

@ -197,6 +197,13 @@ u64 CoreTiming::GetClockTicks() const {
return ticks;
}
u64 CoreTiming::GetGPUTicks() const {
if (is_multicore) [[likely]] {
return clock->GetGPUTick();
}
return Common::WallClock::CNTPCTToGPUTick(ticks);
}
std::optional<s64> CoreTiming::Advance() {
std::scoped_lock lock{advance_lock, basic_lock};
global_timer = GetGlobalTimeNs().count();

View file

@ -119,6 +119,9 @@ public:
/// Returns the current CNTPCT tick value.
u64 GetClockTicks() const;
/// Returns the current GPU tick value.
u64 GetGPUTicks() const;
/// Returns current time in microseconds.
std::chrono::microseconds GetGlobalTimeUs() const;