Count frames in on-demand mode.

This commit is contained in:
Bartosz Taudul 2018-07-10 22:26:40 +02:00
parent 03794a2957
commit 43d5ab4382
2 changed files with 3 additions and 0 deletions

View File

@ -200,6 +200,7 @@ Profiler::Profiler()
, m_serialDequeue( 1024*1024 )
#ifdef TRACY_ON_DEMAND
, m_isConnected( false )
, m_frameCount( 0 )
#endif
{
assert( !s_instance );

View File

@ -119,6 +119,7 @@ public:
static tracy_force_inline void FrameMark()
{
#ifdef TRACY_ON_DEMAND
s_profiler.m_frameCount.fetch_add( 1, std::memory_order_relaxed );
if( !s_profiler.IsConnected() ) return;
#endif
Magic magic;
@ -389,6 +390,7 @@ private:
#ifdef TRACY_ON_DEMAND
std::atomic<bool> m_isConnected;
std::atomic<uint64_t> m_frameCount;
#endif
};