diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 7e43ff25..dd9040f6 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -219,18 +219,6 @@ View::View( FileRead& f ) m_strings.emplace( ptr, std::string( tmp, tmp+ssz ) ); } - f.Read( &sz, sizeof( sz ) ); - for( uint64_t i=0; i pointerMap; f.Read( &sz, sizeof( sz ) ); @@ -248,6 +236,15 @@ View::View( FileRead& f ) pointerMap.emplace( ptr, dst ); } + f.Read( &sz, sizeof( sz ) ); + for( uint64_t i=0; isecond ); + } + f.Read( &sz, sizeof( sz ) ); for( uint64_t i=0; i lock( m_lock ); - m_threadNames.emplace( id, std::move( str ) ); + m_threadNames.emplace( id, sl.ptr ); } void View::AddCustomString( uint64_t ptr, char* str, size_t sz ) @@ -1350,7 +1348,7 @@ const char* View::GetThreadString( uint64_t id ) const } else { - return it->second.c_str(); + return it->second; } } @@ -3247,16 +3245,6 @@ void View::Write( FileWrite& f ) f.Write( v.second.c_str(), v.second.size() ); } - sz = m_threadNames.size(); - f.Write( &sz, sizeof( sz ) ); - for( auto& v : m_threadNames ) - { - f.Write( &v.first, sizeof( v.first ) ); - sz = v.second.size(); - f.Write( &sz, sizeof( sz ) ); - f.Write( v.second.c_str(), v.second.size() ); - } - sz = m_stringData.size(); f.Write( &sz, sizeof( sz ) ); for( auto& v : m_stringData ) @@ -3268,6 +3256,15 @@ void View::Write( FileWrite& f ) f.Write( v, sz ); } + sz = m_threadNames.size(); + f.Write( &sz, sizeof( sz ) ); + for( auto& v : m_threadNames ) + { + f.Write( &v.first, sizeof( v.first ) ); + uint64_t ptr = (uint64_t)v.second; + f.Write( &ptr, sizeof( ptr ) ); + } + sz = m_sourceLocation.size(); f.Write( &sz, sizeof( sz ) ); for( auto& v : m_sourceLocation ) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 4be3ce87..f6801c92 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -149,7 +149,7 @@ private: void CheckSourceLocationPayload( uint64_t ptr, ZoneEvent* dst ); void AddString( uint64_t ptr, std::string&& str ); - void AddThreadString( uint64_t id, std::string&& str ); + void AddThreadString( uint64_t id, char* str, size_t sz ); void AddCustomString( uint64_t ptr, char* str, size_t sz ); void AddSourceLocation( const QueueSourceLocation& srcloc ); void AddSourceLocationPayload( uint64_t ptr, const char* data, size_t sz ); @@ -239,7 +239,7 @@ private: Vector m_textData; Vector m_sourceLocationPayload; std::unordered_map m_strings; - std::unordered_map m_threadNames; + std::unordered_map m_threadNames; std::unordered_map m_sourceLocation; std::vector m_sourceLocationExpand; std::map m_lockMap;