From 454a724f4e618344a9bc1f01e99b2572d6932147 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sun, 6 Mar 2022 15:12:29 +0300 Subject: [PATCH] rsx: Reduce the performance impact of enabling the profiling timer - Just use TSC if available --- rpcs3/Emu/RSX/Common/profiling_timer.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/profiling_timer.hpp b/rpcs3/Emu/RSX/Common/profiling_timer.hpp index a31843b536..7df016b9d1 100644 --- a/rpcs3/Emu/RSX/Common/profiling_timer.hpp +++ b/rpcs3/Emu/RSX/Common/profiling_timer.hpp @@ -1,13 +1,14 @@ #pragma once #include +#include "time.hpp" namespace rsx { struct profiling_timer { bool enabled = false; - steady_clock::time_point last; + u64 last; profiling_timer() = default; @@ -15,7 +16,7 @@ namespace rsx { if (enabled) [[unlikely]] { - last = steady_clock::now(); + last = rsx::uclock(); } } @@ -27,8 +28,8 @@ namespace rsx } auto old = last; - last = steady_clock::now(); - return std::chrono::duration_cast(last - old).count(); + last = rsx::uclock(); + return static_cast(last - old); } }; }