1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

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
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 ) )
void Profiler::HandleSymbolQueueItem( const SymbolQueueItem& si )
{
switch( si.type )
{
@ -3129,6 +3117,23 @@ void Profiler::SymbolWorker()
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
{
if( shouldExit ) return;

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 );