diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 775e76cc..a726aa74 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -263,7 +263,20 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token ) { for( size_t i=0; ihdr.type ) + { + case QueueType::ZoneText: + { + const auto ptr = item->zoneText.text; + SendString( ptr, (const char*)ptr, QueueType::CustomStringData ); + tracy_free( (void*)ptr ); + break; + } + default: + break; + } + if( !AppendData( item, QueueDataSize[m_itemBuf[i].hdr.idx] ) ) return ConnectionLost; } } else @@ -394,10 +407,6 @@ bool Profiler::HandleServerQuery() SendString( ptr, GetThreadName( ptr ), QueueType::ThreadName ); } break; - case ServerQueryCustomString: - SendString( ptr, (const char*)ptr, QueueType::CustomStringData ); - tracy_free( (void*)ptr ); - break; case ServerQuerySourceLocation: SendSourceLocation( ptr ); break; diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index ac0bf491..a0a2db9a 100644 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -21,7 +21,6 @@ enum ServerQuery : uint8_t ServerQueryTerminate, ServerQueryString, ServerQueryThreadString, - ServerQueryCustomString, ServerQuerySourceLocation, ServerQuerySourceLocationPayload, ServerQueryPlotName, diff --git a/server/TracyView.cpp b/server/TracyView.cpp index b75fb2f7..5a1f967c 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -666,7 +666,12 @@ void View::ProcessZoneText( const QueueZoneText& ev ) auto& stack = m_zoneStack[ev.thread]; assert( !stack.empty() ); auto zone = stack.back(); - CheckCustomString( ev.text, zone ); + auto it = m_pendingCustomStrings.find( ev.text ); + assert( it != m_pendingCustomStrings.end() ); + m_lock.lock(); + GetTextData( *zone )->userText = it->second; + m_lock.unlock(); + m_pendingCustomStrings.erase( it ); } void View::ProcessZoneName( const QueueZoneName& ev ) @@ -836,14 +841,6 @@ void View::CheckThreadString( uint64_t id ) ServerQuery( ServerQueryThreadString, id ); } -void View::CheckCustomString( uint64_t ptr, ZoneEvent* dst ) -{ - assert( m_pendingCustomStrings.find( ptr ) == m_pendingCustomStrings.end() ); - m_pendingCustomStrings.emplace( ptr, dst ); - - ServerQuery( ServerQueryCustomString, ptr ); -} - void View::CheckSourceLocation( uint64_t ptr ) { if( m_sourceLocation.find( ptr ) != m_sourceLocation.end() ) return; @@ -886,13 +883,9 @@ void View::AddThreadString( uint64_t id, char* str, size_t sz ) void View::AddCustomString( uint64_t ptr, char* str, size_t sz ) { - auto pit = m_pendingCustomStrings.find( ptr ); - assert( pit != m_pendingCustomStrings.end() ); const auto sl = StoreString( str, sz ); - m_lock.lock(); - GetTextData( *pit->second )->userText = sl.ptr; - m_lock.unlock(); - m_pendingCustomStrings.erase( pit ); + assert( m_pendingCustomString.find( ptr ) == m_pendingCustomStrings.end() ); + m_pendingCustomStrings.emplace( ptr, sl.ptr ); } View::StringLocation View::StoreString( char* str, size_t sz ) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index e488c628..638f9b0e 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -148,7 +148,6 @@ private: void CheckString( uint64_t ptr ); void CheckThreadString( uint64_t id ); - void CheckCustomString( uint64_t ptr, ZoneEvent* dst ); void CheckSourceLocation( uint64_t ptr ); void CheckSourceLocationPayload( uint64_t ptr, ZoneEvent* dst ); @@ -260,7 +259,7 @@ private: std::unordered_set m_pendingStrings; std::unordered_set m_pendingThreads; std::unordered_set m_pendingSourceLocation; - std::unordered_map m_pendingCustomStrings; + std::unordered_map m_pendingCustomStrings; std::unordered_map m_threadMap; std::unordered_map m_plotMap; std::unordered_map m_plotRev;