Extract symbol queue item handling.

This commit is contained in:
Bartosz Taudul 2021-10-23 01:35:01 +02:00
parent 2b9265cc40
commit 02ce9b7d8b
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 73 additions and 67 deletions

View File

@ -3047,20 +3047,8 @@ void Profiler::QueueExternalName( uint64_t ptr )
}
#ifdef TRACY_HAS_CALLSTACK
void Profiler::SymbolWorker()
void Profiler::HandleSymbolQueueItem( const SymbolQueueItem& si )
{
ThreadExitHandler threadExitHandler;
SetThreadName( "Tracy Symbol Worker" );
while( m_timeBegin.load( std::memory_order_relaxed ) == 0 ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
rpmalloc_thread_initialize();
for(;;)
{
const auto shouldExit = ShouldExit();
SymbolQueueItem si;
if( m_symbolQueue.try_dequeue( si ) )
{
switch( si.type )
{
case SymbolQueueItemType::CallstackFrame:
@ -3128,6 +3116,23 @@ void Profiler::SymbolWorker()
assert( false );
break;
}
}
void Profiler::SymbolWorker()
{
ThreadExitHandler threadExitHandler;
SetThreadName( "Tracy Symbol Worker" );
while( m_timeBegin.load( std::memory_order_relaxed ) == 0 ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
rpmalloc_thread_initialize();
for(;;)
{
const auto shouldExit = ShouldExit();
SymbolQueueItem si;
if( m_symbolQueue.try_dequeue( si ) )
{
HandleSymbolQueueItem( si );
}
else
{

View File

@ -680,6 +680,7 @@ private:
#ifdef TRACY_HAS_CALLSTACK
static void LaunchSymbolWorker( void* ptr ) { ((Profiler*)ptr)->SymbolWorker(); }
void SymbolWorker();
void HandleSymbolQueueItem( const SymbolQueueItem& si );
#endif
void ClearQueues( tracy::moodycamel::ConsumerToken& token );