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
parent cfecbb24ca
commit 454a724f4e
1 changed files with 5 additions and 4 deletions

View File

@ -1,13 +1,14 @@
#pragma once
#include <util/types.hpp>
#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<std::chrono::microseconds>(last - old).count();
last = rsx::uclock();
return static_cast<s64>(last - old);
}
};
}