mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-10-01 21:59:35 +00:00
rsx: Reduce the performance impact of enabling the profiling timer
- Just use TSC if available
This commit is contained in:
parent
cfecbb24ca
commit
454a724f4e
1 changed files with 5 additions and 4 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue