Store list of symbol locations.

This commit is contained in:
Bartosz Taudul 2020-03-27 17:34:51 +01:00
parent 52a853b26f
commit 4c381e13e9
3 changed files with 29 additions and 0 deletions

View File

@ -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<CallstackFrame> data;

View File

@ -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 );
}

View File

@ -233,6 +233,8 @@ private:
unordered_flat_map<CallstackFrameData*, CallstackFrameId, RevFrameHash, RevFrameComp> revFrameMap;
unordered_flat_map<uint64_t, SymbolData> symbolMap;
unordered_flat_map<uint64_t, SymbolStats> symbolStats;
Vector<SymbolLocation> symbolLoc;
bool newSymbolsWereAdded = false;
#ifndef TRACY_NO_STATISTICS
unordered_flat_map<VarArray<CallstackFrameId>*, uint32_t, VarArrayHasher<CallstackFrameId>, VarArrayComparator<CallstackFrameId>> parentCallstackMap;