mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 13:25:45 +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)};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue