Save/load symbol code.

This commit is contained in:
Bartosz Taudul 2020-03-25 20:52:59 +01:00
parent a05ec0eed2
commit 033433b883
2 changed files with 40 additions and 0 deletions

View File

@ -1671,6 +1671,36 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
}
}
if( fileVer >= FileVersion( 0, 6, 7 ) )
{
f.Read( sz );
if( eventMask & EventType::SymbolCode )
{
uint64_t ssz = 0;
m_data.symbolCode.reserve( sz );
for( uint64_t i=0; i<sz; i++ )
{
uint64_t symAddr;
uint32_t len;
f.Read2( symAddr, len );
ssz += len;
auto ptr = (char*)m_slab.AllocBig( len );
f.Read( ptr, len );
m_data.symbolCode.emplace( symAddr, SymbolCodeData { ptr, len } );
}
m_data.symbolCodeSize = ssz;
}
else
{
for( uint64_t i=0; i<sz; i++ )
{
uint64_t symAddr, len;
f.Read2( symAddr, len );
f.Skip( len );
}
}
}
s_loadProgress.total.store( 0, std::memory_order_relaxed );
m_loadTime = std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now() - loadStart ).count();
@ -6623,6 +6653,15 @@ void Worker::Write( FileWrite& f )
f.Write( &v.first, sizeof( v.first ) );
f.Write( &v.second, sizeof( v.second ) );
}
sz = m_data.symbolCode.size();
f.Write( &sz, sizeof( sz ) );
for( auto& v : m_data.symbolCode )
{
f.Write( &v.first, sizeof( v.first ) );
f.Write( &v.second.len, sizeof( v.second.len ) );
f.Write( &v.second.data, v.second.len );
}
}
void Worker::WriteTimeline( FileWrite& f, const Vector<short_ptr<ZoneEvent>>& vec, int64_t& refTime )

View File

@ -43,6 +43,7 @@ namespace EventType
FrameImages = 1 << 4,
ContextSwitches = 1 << 5,
Samples = 1 << 6,
SymbolCode = 1 << 7,
None = 0,
All = std::numeric_limits<uint32_t>::max()