diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 6f0cbc78..8aaf7f9c 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -116,6 +116,8 @@ void View::ProcessZoneBegin( uint64_t id, const QueueZoneBegin& ev ) { auto it = m_pendingEndZone.find( id ); const auto idx = m_data.size(); + CheckString( ev.filename ); + CheckString( ev.function ); std::unique_lock lock( m_lock ); if( it == m_pendingEndZone.end() ) { @@ -152,4 +154,13 @@ void View::ProcessZoneEnd( uint64_t id, const QueueZoneEnd& ev ) } } +void View::CheckString( uint64_t ptr ) +{ + if( m_strings.find( ptr ) != m_strings.end() ) return; + if( m_pendingStrings.find( ptr ) != m_pendingStrings.end() ) return; + + m_pendingStrings.emplace( ptr ); + m_sock.Send( &ptr, sizeof( ptr ) ); +} + } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 0e48a3a1..a1f0e84c 100755 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "../common/TracySocket.hpp" @@ -33,6 +34,8 @@ private: void ProcessZoneBegin( uint64_t id, const QueueZoneBegin& ev ); void ProcessZoneEnd( uint64_t id, const QueueZoneEnd& ev ); + void CheckString( uint64_t ptr ); + std::string m_addr; Socket m_sock; @@ -44,10 +47,12 @@ private: std::mutex m_lock; std::vector m_data; std::vector m_timeline; + std::unordered_map m_strings; // not used for vis - no need to lock std::unordered_map m_pendingEndZone; std::unordered_map m_openZones; + std::unordered_set m_pendingStrings; }; }