mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Save/load cached source files.
This commit is contained in:
parent
5b96809f6f
commit
2f35c785ee
@ -7,7 +7,7 @@ namespace Version
|
||||
{
|
||||
enum { Major = 0 };
|
||||
enum { Minor = 6 };
|
||||
enum { Patch = 12 };
|
||||
enum { Patch = 13 };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1837,6 +1837,38 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
}
|
||||
}
|
||||
|
||||
if( fileVer >= FileVersion( 0, 6, 13 ) )
|
||||
{
|
||||
f.Read( sz );
|
||||
if( eventMask & EventType::SourceCache )
|
||||
{
|
||||
m_data.sourceFileCache.reserve( sz );
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
uint32_t len;
|
||||
f.Read( len );
|
||||
auto key = m_slab.Alloc<char>( len+1 );
|
||||
f.Read( key, len );
|
||||
key[len] = '\0';
|
||||
f.Read( len );
|
||||
auto data = (char*)m_slab.AllocBig( len );
|
||||
f.Read( data, len );
|
||||
m_data.sourceFileCache.emplace( key, MemoryBlock { data, len } );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
uint32_t s32;
|
||||
f.Read( s32 );
|
||||
f.Skip( s32 );
|
||||
f.Read( s32 );
|
||||
f.Skip( s32 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@ -7195,6 +7227,17 @@ void Worker::Write( FileWrite& f )
|
||||
f.Write( &diff, sizeof( diff ) );
|
||||
}
|
||||
}
|
||||
|
||||
sz = m_data.sourceFileCache.size();
|
||||
f.Write( &sz, sizeof( sz ) );
|
||||
for( auto& v : m_data.sourceFileCache )
|
||||
{
|
||||
uint32_t s32 = strlen( v.first );
|
||||
f.Write( &s32, sizeof( s32 ) );
|
||||
f.Write( v.first, s32 );
|
||||
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 )
|
||||
|
@ -44,6 +44,7 @@ namespace EventType
|
||||
ContextSwitches = 1 << 5,
|
||||
Samples = 1 << 6,
|
||||
SymbolCode = 1 << 7,
|
||||
SourceCache = 1 << 8,
|
||||
|
||||
None = 0,
|
||||
All = std::numeric_limits<uint32_t>::max()
|
||||
|
Loading…
Reference in New Issue
Block a user