From 0244c4046e9970b0541a8d55303492b53a9c3f02 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 14 May 2022 17:42:19 +0300 Subject: [PATCH] rsx: Lower performance hit due to frequency fetch --- rpcs3/Emu/RSX/Common/time.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/time.hpp b/rpcs3/Emu/RSX/Common/time.hpp index 5faed311f5..430ba3fade 100644 --- a/rpcs3/Emu/RSX/Common/time.hpp +++ b/rpcs3/Emu/RSX/Common/time.hpp @@ -9,9 +9,11 @@ namespace rsx { static inline u64 uclock() { - if (const u64 freq = (utils::get_tsc_freq() / 1000000)) + static const ullong s_tsc_scaled_freq = (utils::get_tsc_freq() / 1000000); + + if (s_tsc_scaled_freq) { - return utils::get_tsc() / freq; + return utils::get_tsc() / s_tsc_scaled_freq; } else {