From 096366ead51345bcd170e31b6160b14aaf73e996 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Tue, 23 Nov 2021 03:29:00 +0100 Subject: Common: improve native clock. --- src/common/x64/native_clock.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/common/x64/native_clock.h') diff --git a/src/common/x64/native_clock.h b/src/common/x64/native_clock.h index 30d2ba2e9..e57446cb9 100644 --- a/src/common/x64/native_clock.h +++ b/src/common/x64/native_clock.h @@ -3,6 +3,7 @@ #pragma once +#include #include "common/wall_clock.h" namespace Common { @@ -28,13 +29,9 @@ public: private: u64 GetRTSC(); - union alignas(16) TimePoint { - TimePoint() : pack{} {} - u128 pack{}; - struct Inner { - u64 last_measure{}; - u64 accumulated_ticks{}; - } inner; + struct alignas(16) TimePoint { + u64 last_measure{}; + u64 accumulated_ticks{}; }; /// value used to reduce the native clocks accuracy as some apss rely on @@ -42,7 +39,7 @@ private: /// be higher. static constexpr u64 inaccuracy_mask = ~(UINT64_C(0x400) - 1); - TimePoint time_point; + std::atomic time_point; // factors u64 clock_rtsc_factor{}; u64 cpu_rtsc_factor{}; -- cgit v1.2.3