diff options
Diffstat (limited to 'src/common/x64/native_clock.h')
-rw-r--r-- | src/common/x64/native_clock.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/common/x64/native_clock.h b/src/common/x64/native_clock.h index a7b1ee9e0..7cbd400d2 100644 --- a/src/common/x64/native_clock.h +++ b/src/common/x64/native_clock.h @@ -6,7 +6,6 @@ #include <optional> -#include "common/spin_lock.h" #include "common/wall_clock.h" namespace Common { @@ -32,22 +31,29 @@ public: private: u64 GetRTSC(); + union alignas(16) TimePoint { + TimePoint() : pack{} {} + u128 pack{}; + struct Inner { + u64 last_measure{}; + u64 accumulated_ticks{}; + } inner; + }; + /// value used to reduce the native clocks accuracy as some apss rely on /// undefined behavior where the level of accuracy in the clock shouldn't /// be higher. static constexpr u64 inaccuracy_mask = ~(UINT64_C(0x400) - 1); - SpinLock rtsc_serialize{}; - u64 last_measure{}; - u64 accumulated_ticks{}; - u64 rtsc_frequency; - + TimePoint time_point; // factors + u64 clock_rtsc_factor{}; + u64 cpu_rtsc_factor{}; u64 ns_rtsc_factor{}; u64 us_rtsc_factor{}; u64 ms_rtsc_factor{}; - u64 clock_rtsc_factor{}; - u64 cpu_rtsc_factor{}; + + u64 rtsc_frequency; }; } // namespace X64 |