mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
36 lines
433 B
C++
36 lines
433 B
C++
#pragma once
|
|
|
|
#include <util/types.hpp>
|
|
#include "time.hpp"
|
|
|
|
namespace rsx
|
|
{
|
|
struct profiling_timer
|
|
{
|
|
bool enabled = false;
|
|
u64 last;
|
|
|
|
profiling_timer() = default;
|
|
|
|
void start()
|
|
{
|
|
if (enabled) [[unlikely]]
|
|
{
|
|
last = rsx::uclock();
|
|
}
|
|
}
|
|
|
|
s64 duration()
|
|
{
|
|
if (!enabled) [[likely]]
|
|
{
|
|
return 0ll;
|
|
}
|
|
|
|
auto old = last;
|
|
last = rsx::uclock();
|
|
return static_cast<s64>(last - old);
|
|
}
|
|
};
|
|
}
|