diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-01-02 02:24:49 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-01-02 04:00:27 +0100 |
commit | 53d92318b82cd4a9e08f814fcb8aab624d795c6c (patch) | |
tree | 4f5236ffebdcf947297d8ace42151b36810f3144 /src/common/x64/native_clock.h | |
parent | X86/NativeClock: Improve performance of clock calculations on hot path. (diff) | |
download | yuzu-53d92318b82cd4a9e08f814fcb8aab624d795c6c.tar yuzu-53d92318b82cd4a9e08f814fcb8aab624d795c6c.tar.gz yuzu-53d92318b82cd4a9e08f814fcb8aab624d795c6c.tar.bz2 yuzu-53d92318b82cd4a9e08f814fcb8aab624d795c6c.tar.lz yuzu-53d92318b82cd4a9e08f814fcb8aab624d795c6c.tar.xz yuzu-53d92318b82cd4a9e08f814fcb8aab624d795c6c.tar.zst yuzu-53d92318b82cd4a9e08f814fcb8aab624d795c6c.zip |
Diffstat (limited to '')
-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 |