HostTiming: Pause the hardware clock on pause.
This commit is contained in:
parent
6bf137a0e8
commit
18dcb09342
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