Adapt to SPSCQueue interface.

This commit is contained in:
Bartosz Taudul 2021-11-14 18:50:59 +01:00
parent 93f83fc50c
commit a203eb5aef
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 21 additions and 10 deletions

View File

@ -1901,8 +1901,13 @@ void Profiler::Worker()
}
#ifdef TRACY_HAS_CALLSTACK
SymbolQueueItem si;
while( m_symbolQueue.try_dequeue( si ) ) HandleSymbolQueueItem( si );
for(;;)
{
auto si = m_symbolQueue.front();
if( !si ) break;
HandleSymbolQueueItem( *si );
m_symbolQueue.pop();
}
#endif
}
@ -1928,8 +1933,13 @@ void Profiler::Worker()
}
}
#ifdef TRACY_HAS_CALLSTACK
SymbolQueueItem si;
while( m_symbolQueue.try_dequeue( si ) ) HandleSymbolQueueItem( si );
for(;;)
{
auto si = m_symbolQueue.front();
if( !si ) break;
HandleSymbolQueueItem( *si );
m_symbolQueue.pop();
}
#endif
while( Dequeue( token ) == DequeueStatus::DataDequeued ) {}
while( DequeueSerial() == DequeueStatus::DataDequeued ) {}
@ -3171,19 +3181,20 @@ void Profiler::SymbolWorker()
for(;;)
{
const auto shouldExit = ShouldExit();
SymbolQueueItem si;
#ifdef TRACY_ON_DEMAND
if( !IsConnected() )
{
if( shouldExit ) return;
while( m_symbolQueue.pop() ) {}
while( m_symbolQueue.front() ) m_symbolQueue.pop();
std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) );
continue;
}
#endif
if( m_symbolQueue.try_dequeue( si ) )
auto si = m_symbolQueue.front();
if( si )
{
HandleSymbolQueueItem( si );
HandleSymbolQueueItem( *si );
m_symbolQueue.pop();
}
else
{

View File

@ -8,7 +8,7 @@
#include <time.h>
#include "tracy_concurrentqueue.h"
#include "tracy_readerwriterqueue.h"
#include "tracy_SPSCQueue.h"
#include "TracyCallstack.hpp"
#include "TracySysTime.hpp"
#include "TracyFastVector.hpp"
@ -864,7 +864,7 @@ private:
TracyMutex m_fiLock;
#endif
ReaderWriterQueue<SymbolQueueItem> m_symbolQueue;
SPSCQueue<SymbolQueueItem> m_symbolQueue;
std::atomic<uint64_t> m_frameCount;
std::atomic<bool> m_isConnected;