rsx: Reduce the performance impact of enabling the profiling timer

- Just use TSC if available
This commit is contained in:
kd-11 2022-03-06 15:12:29 +03:00 committed by kd-11
commit 454a724f4e

View file

@ -1,13 +1,14 @@
#pragma once #pragma once
#include <util/types.hpp> #include <util/types.hpp>
#include "time.hpp"
namespace rsx namespace rsx
{ {
struct profiling_timer struct profiling_timer
{ {
bool enabled = false; bool enabled = false;
steady_clock::time_point last; u64 last;
profiling_timer() = default; profiling_timer() = default;
@ -15,7 +16,7 @@ namespace rsx
{ {
if (enabled) [[unlikely]] if (enabled) [[unlikely]]
{ {
last = steady_clock::now(); last = rsx::uclock();
} }
} }
@ -27,8 +28,8 @@ namespace rsx
} }
auto old = last; auto old = last;
last = steady_clock::now(); last = rsx::uclock();
return std::chrono::duration_cast<std::chrono::microseconds>(last - old).count(); return static_cast<s64>(last - old);
} }
}; };
} }