diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 853cfe1e..d970b981 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -339,6 +339,16 @@ enum { CallstackFrameBasicSize = sizeof( CallstackFrameBasic ) }; enum { CallstackFrameSize = sizeof( CallstackFrame ) }; enum { SymbolDataSize = sizeof( SymbolData ) }; + +struct SymbolLocation +{ + uint64_t addr; + uint32_t len; +}; + +enum { SymbolLocationSize = sizeof( SymbolLocation ) }; + + struct CallstackFrameData { short_ptr data; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index dfba2357..a1cc0b62 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -1658,7 +1658,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) Int24 size; f.Read9( symAddr, name, file, line, imageName, callFile, callLine, isInline, size ); m_data.symbolMap.emplace( symAddr, SymbolData { name, file, line, imageName, callFile, callLine, isInline, size } ); + m_data.symbolLoc.push_back( SymbolLocation { symAddr, size.Val() } ); } +#ifdef NO_PARALLEL_SORT + pdqsort_branchless( m_data.symbolLoc.begin(), m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } ); +#else + std::sort( std::execution::par_unseq, m_data.symbolLoc.begin(), m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } ); +#endif } else if( fileVer >= FileVersion( 0, 6, 5 ) ) { @@ -2773,6 +2779,15 @@ void Worker::Exec() HandlePostponedSamples(); m_data.newFramesWereReceived = false; #endif + if( m_data.newSymbolsWereAdded ) + { + m_data.newSymbolsWereAdded = false; +#ifdef NO_PARALLEL_SORT + pdqsort_branchless( m_data.symbolLoc.begin(), m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } ); +#else + std::sort( std::execution::par_unseq, m_data.symbolLoc.begin(), m_data.symbolLoc.end(), [] ( const auto& l, const auto& r ) { return l.addr < r.addr; } ); +#endif + } while( !m_serverQueryQueue.empty() && m_serverQuerySpaceLeft > 0 ) { @@ -5276,6 +5291,8 @@ void Worker::ProcessSymbolInformation( const QueueSymbolInformation& ev ) Query( ServerQuerySymbolCode, ev.symAddr, it->second.size ); } + m_data.symbolLoc.push_back( SymbolLocation { ev.symAddr, it->second.size } ); + m_pendingSymbols.erase( it ); m_pendingCustomStrings.erase( fit ); } diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 540df639..a353d7b0 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -233,6 +233,8 @@ private: unordered_flat_map revFrameMap; unordered_flat_map symbolMap; unordered_flat_map symbolStats; + Vector symbolLoc; + bool newSymbolsWereAdded = false; #ifndef TRACY_NO_STATISTICS unordered_flat_map*, uint32_t, VarArrayHasher, VarArrayComparator> parentCallstackMap;