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,19 +3047,7 @@ void Profiler::QueueExternalName( uint64_t ptr )
} }
#ifdef TRACY_HAS_CALLSTACK #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 ) switch( si.type )
{ {
@ -3129,6 +3117,23 @@ void Profiler::SymbolWorker()
break; 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 else
{ {
if( shouldExit ) return; if( shouldExit ) return;

View File

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