Allow checking timer implementation.

This commit is contained in:
Bartosz Taudul 2019-08-14 14:35:44 +02:00
parent e39b1abce5
commit 602c38c6c0
2 changed files with 12 additions and 3 deletions

View File

@ -2141,16 +2141,23 @@ void Profiler::HandleDisconnect()
} }
} }
bool Profiler::IsTimerMonotonicRaw()
{
#if defined TRACY_HW_TIMER && !defined TARGET_OS_IOS && __ARM_ARCH >= 6
return GetTimeImpl == GetTimeImplFallback;
#else
return false;
#endif
}
void Profiler::CalibrateTimer() void Profiler::CalibrateTimer()
{ {
#ifdef TRACY_HW_TIMER #ifdef TRACY_HW_TIMER
# if __ARM_ARCH >= 6 && !defined TARGET_OS_IOS if( IsTimerMonotonicRaw() )
if( GetTimeImpl == GetTimeImplFallback )
{ {
m_timerMul = 1.; m_timerMul = 1.;
return; return;
} }
# endif
std::atomic_signal_fence( std::memory_order_acq_rel ); std::atomic_signal_fence( std::memory_order_acq_rel );
const auto t0 = std::chrono::high_resolution_clock::now(); const auto t0 = std::chrono::high_resolution_clock::now();

View File

@ -440,6 +440,8 @@ public:
void RequestShutdown() { m_shutdown.store( true, std::memory_order_relaxed ); m_shutdownManual.store( true, std::memory_order_relaxed ); } void RequestShutdown() { m_shutdown.store( true, std::memory_order_relaxed ); m_shutdownManual.store( true, std::memory_order_relaxed ); }
bool HasShutdownFinished() const { return m_shutdownFinished.load( std::memory_order_relaxed ); } bool HasShutdownFinished() const { return m_shutdownFinished.load( std::memory_order_relaxed ); }
static bool IsTimerMonotonicRaw();
private: private:
enum class DequeueStatus { Success, ConnectionLost, QueueEmpty }; enum class DequeueStatus { Success, ConnectionLost, QueueEmpty };