diff options
Diffstat (limited to 'src/common/x64/native_clock.h')
| -rw-r--r-- | src/common/x64/native_clock.h | 13 |
1 files changed, 5 insertions, 8 deletions
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 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <atomic> | ||
| 6 | #include "common/wall_clock.h" | 7 | #include "common/wall_clock.h" |
| 7 | 8 | ||
| 8 | namespace Common { | 9 | namespace Common { |
| @@ -28,13 +29,9 @@ public: | |||
| 28 | private: | 29 | private: |
| 29 | u64 GetRTSC(); | 30 | u64 GetRTSC(); |
| 30 | 31 | ||
| 31 | union alignas(16) TimePoint { | 32 | struct alignas(16) TimePoint { |
| 32 | TimePoint() : pack{} {} | 33 | u64 last_measure{}; |
| 33 | u128 pack{}; | 34 | u64 accumulated_ticks{}; |
| 34 | struct Inner { | ||
| 35 | u64 last_measure{}; | ||
| 36 | u64 accumulated_ticks{}; | ||
| 37 | } inner; | ||
| 38 | }; | 35 | }; |
| 39 | 36 | ||
| 40 | /// value used to reduce the native clocks accuracy as some apss rely on | 37 | /// value used to reduce the native clocks accuracy as some apss rely on |
| @@ -42,7 +39,7 @@ private: | |||
| 42 | /// be higher. | 39 | /// be higher. |
| 43 | static constexpr u64 inaccuracy_mask = ~(UINT64_C(0x400) - 1); | 40 | static constexpr u64 inaccuracy_mask = ~(UINT64_C(0x400) - 1); |
| 44 | 41 | ||
| 45 | TimePoint time_point; | 42 | std::atomic<TimePoint> time_point; |
| 46 | // factors | 43 | // factors |
| 47 | u64 clock_rtsc_factor{}; | 44 | u64 clock_rtsc_factor{}; |
| 48 | u64 cpu_rtsc_factor{}; | 45 | u64 cpu_rtsc_factor{}; |