mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-26 15:48:14 -05:00
HostTiming: Pause the hardware clock on pause.
This commit is contained in:
@ -65,6 +65,13 @@ u64 NativeClock::GetRTSC() {
|
||||
return accumulated_ticks;
|
||||
}
|
||||
|
||||
void NativeClock::Pause(bool is_paused) {
|
||||
if (!is_paused) {
|
||||
_mm_mfence();
|
||||
last_measure = __rdtsc();
|
||||
}
|
||||
}
|
||||
|
||||
std::chrono::nanoseconds NativeClock::GetTimeNS() {
|
||||
const u64 rtsc_value = GetRTSC();
|
||||
return std::chrono::nanoseconds{MultiplyAndDivide64(rtsc_value, 1000000000, rtsc_frequency)};
|
||||
|
@ -26,6 +26,8 @@ public:
|
||||
|
||||
u64 GetCPUCycles() override;
|
||||
|
||||
void Pause(bool is_paused) override;
|
||||
|
||||
private:
|
||||
u64 GetRTSC();
|
||||
|
||||
|
Reference in New Issue
Block a user