diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index a726aa74..e78294ec 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -264,15 +264,19 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token ) for( size_t i=0; ihdr.type ) { case QueueType::ZoneText: - { - const auto ptr = item->zoneText.text; + ptr = item->zoneText.text; + SendString( ptr, (const char*)ptr, QueueType::CustomStringData ); + tracy_free( (void*)ptr ); + break; + case QueueType::Message: + ptr = item->message.text; SendString( ptr, (const char*)ptr, QueueType::CustomStringData ); tracy_free( (void*)ptr ); break; - } default: break; } @@ -322,7 +326,7 @@ bool Profiler::SendData( const char* data, size_t len ) bool Profiler::SendString( uint64_t str, const char* ptr, QueueType type ) { - assert( type == QueueType::StringData || type == QueueType::ThreadName || type == QueueType::CustomStringData || type == QueueType::PlotName || type == QueueType::MessageData ); + assert( type == QueueType::StringData || type == QueueType::ThreadName || type == QueueType::CustomStringData || type == QueueType::PlotName ); QueueItem item; item.hdr.type = type; @@ -417,10 +421,6 @@ bool Profiler::HandleServerQuery() case ServerQueryPlotName: SendString( ptr, (const char*)ptr, QueueType::PlotName ); break; - case ServerQueryMessage: - SendString( ptr, (const char*)ptr, QueueType::MessageData ); - tracy_free( (void*)ptr ); - break; case ServerQueryTerminate: return false; default: diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index a0a2db9a..03aa4d82 100644 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -24,7 +24,6 @@ enum ServerQuery : uint8_t ServerQuerySourceLocation, ServerQuerySourceLocationPayload, ServerQueryPlotName, - ServerQueryMessage, }; enum { WelcomeMessageProgramNameSize = 64 }; diff --git a/common/TracyQueue.hpp b/common/TracyQueue.hpp index c0fa55f3..6a4c827c 100644 --- a/common/TracyQueue.hpp +++ b/common/TracyQueue.hpp @@ -28,7 +28,6 @@ enum class QueueType : uint8_t PlotName, Message, MessageLiteral, - MessageData, NUM_TYPES }; @@ -193,7 +192,6 @@ static const size_t QueueDataSize[] = { sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // plot name sizeof( QueueHeader ) + sizeof( QueueMessage ), sizeof( QueueHeader ) + sizeof( QueueMessage ), // literal - sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // message data }; static_assert( QueueItemSize == 32, "Queue item size not 32 bytes" ); diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 5a1f967c..63549fcc 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -468,7 +468,7 @@ void View::Worker() if( m_terminate ) { if( !m_pendingStrings.empty() || !m_pendingThreads.empty() || !m_pendingSourceLocation.empty() || - !m_pendingCustomStrings.empty() || !m_pendingPlots.empty() || !m_pendingMessages.empty() ) + !m_pendingCustomStrings.empty() || !m_pendingPlots.empty() ) { continue; } @@ -496,7 +496,7 @@ close: void View::DispatchProcess( const QueueItem& ev, char*& ptr ) { ptr += QueueDataSize[ev.hdr.idx]; - if( ev.hdr.type == QueueType::CustomStringData || ev.hdr.type == QueueType::StringData || ev.hdr.type == QueueType::ThreadName || ev.hdr.type == QueueType::PlotName || ev.hdr.type == QueueType::MessageData || ev.hdr.type == QueueType::SourceLocationPayload ) + if( ev.hdr.type == QueueType::CustomStringData || ev.hdr.type == QueueType::StringData || ev.hdr.type == QueueType::ThreadName || ev.hdr.type == QueueType::PlotName || ev.hdr.type == QueueType::SourceLocationPayload ) { uint16_t sz; memcpy( &sz, ptr, sizeof( sz ) ); @@ -515,9 +515,6 @@ void View::DispatchProcess( const QueueItem& ev, char*& ptr ) case QueueType::PlotName: HandlePlotName( ev.stringTransfer.ptr, ptr, sz ); break; - case QueueType::MessageData: - AddMessageData( ev.stringTransfer.ptr, ptr, sz ); - break; case QueueType::SourceLocationPayload: AddSourceLocationPayload( ev.stringTransfer.ptr, ptr, sz ); break; @@ -669,7 +666,7 @@ void View::ProcessZoneText( const QueueZoneText& ev ) auto it = m_pendingCustomStrings.find( ev.text ); assert( it != m_pendingCustomStrings.end() ); m_lock.lock(); - GetTextData( *zone )->userText = it->second; + GetTextData( *zone )->userText = it->second.ptr; m_lock.unlock(); m_pendingCustomStrings.erase( it ); } @@ -807,8 +804,14 @@ void View::ProcessPlotData( const QueuePlotData& ev ) void View::ProcessMessage( const QueueMessage& ev ) { - m_pendingMessages.emplace( ev.text, MessagePending { int64_t( ev.time * m_timerMul ), ev.thread } ); - ServerQuery( ServerQueryMessage, ev.text ); + auto it = m_pendingCustomStrings.find( ev.text ); + assert( it != m_pendingCustomStrings.end() ); + auto msg = m_slab.Alloc(); + msg->time = int64_t( ev.time * m_timerMul ); + msg->ref.isidx = true; + msg->ref.stridx = it->second.idx; + InsertMessageData( msg, ev.thread ); + m_pendingCustomStrings.erase( it ); } void View::ProcessMessageLiteral( const QueueMessage& ev ) @@ -883,9 +886,8 @@ void View::AddThreadString( uint64_t id, char* str, size_t sz ) void View::AddCustomString( uint64_t ptr, char* str, size_t sz ) { - const auto sl = StoreString( str, sz ); assert( m_pendingCustomString.find( ptr ) == m_pendingCustomStrings.end() ); - m_pendingCustomStrings.emplace( ptr, sl.ptr ); + m_pendingCustomStrings.emplace( ptr, StoreString( str, sz ) ); } View::StringLocation View::StoreString( char* str, size_t sz ) @@ -966,20 +968,6 @@ void View::AddSourceLocationPayload( uint64_t ptr, char* data, size_t sz ) m_pendingSourceLocationPayload.erase( pit ); } -void View::AddMessageData( uint64_t ptr, char* str, size_t sz ) -{ - const auto sl = StoreString( str, sz ); - - auto it = m_pendingMessages.find( ptr ); - assert( it != m_pendingMessages.end() ); - auto msg = m_slab.Alloc(); - msg->time = it->second.time; - msg->ref.isidx = true; - msg->ref.stridx = sl.idx; - InsertMessageData( msg, it->second.thread ); - m_pendingMessages.erase( it ); -} - uint32_t View::ShrinkSourceLocation( uint64_t srcloc ) { auto it = m_sourceLocationShrink.find( srcloc ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 638f9b0e..a8a1d025 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -46,12 +46,6 @@ private: Short }; - struct MessagePending - { - int64_t time; - uint64_t thread; - }; - struct MessageData { int64_t time; @@ -156,7 +150,6 @@ private: void AddCustomString( uint64_t ptr, char* str, size_t sz ); void AddSourceLocation( const QueueSourceLocation& srcloc ); void AddSourceLocationPayload( uint64_t ptr, char* data, size_t sz ); - void AddMessageData( uint64_t ptr, char* str, size_t sz ); StringLocation StoreString( char* str, size_t sz ); @@ -259,12 +252,11 @@ 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; std::unordered_map m_pendingPlots; - std::unordered_map m_pendingMessages; std::unordered_map m_sourceLocationShrink; std::unordered_map m_pendingSourceLocationPayload;