mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-21 04:08:03 +00:00
HostTiming: Pause the hardware clock on pause.
This commit is contained in:
parent
0fd333a248
commit
fb1d75a788
7 changed files with 23 additions and 1 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue