Drop support for pre-v0.5 traces.

This commit is contained in:
Bartosz Taudul 2019-11-21 21:48:35 +01:00
parent b749e816e9
commit fb6a92380d
2 changed files with 154 additions and 620 deletions

View File

@ -52,7 +52,7 @@ static inline CallstackFrameId PackPointer( uint64_t ptr )
static const uint8_t FileHeader[8] { 't', 'r', 'a', 'c', 'y', Version::Major, Version::Minor, Version::Patch }; static const uint8_t FileHeader[8] { 't', 'r', 'a', 'c', 'y', Version::Major, Version::Minor, Version::Patch };
enum { FileHeaderMagic = 5 }; enum { FileHeaderMagic = 5 };
static const int CurrentVersion = FileVersion( Version::Major, Version::Minor, Version::Patch ); static const int CurrentVersion = FileVersion( Version::Major, Version::Minor, Version::Patch );
static const int MinSupportedVersion = FileVersion( 0, 4, 0 ); static const int MinSupportedVersion = FileVersion( 0, 5, 0 );
static void UpdateLockCountLockable( LockMap& lockmap, size_t pos ) static void UpdateLockCountLockable( LockMap& lockmap, size_t pos )
@ -293,11 +293,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
} }
m_traceVersion = fileVer; m_traceVersion = fileVer;
if( fileVer <= FileVersion( 0, 4, 8 ) ) if( fileVer == FileVersion( 0, 5, 0 ) )
{
s_loadProgress.total.store( 8, std::memory_order_relaxed );
}
else if( fileVer <= FileVersion( 0, 5, 0 ) )
{ {
s_loadProgress.total.store( 9, std::memory_order_relaxed ); s_loadProgress.total.store( 9, std::memory_order_relaxed );
} }
@ -357,8 +353,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
uint64_t fsz; uint64_t fsz;
f.Read3( ptr->name, ptr->continuous, fsz ); f.Read3( ptr->name, ptr->continuous, fsz );
ptr->frames.reserve_exact( fsz, m_slab ); ptr->frames.reserve_exact( fsz, m_slab );
if( fileVer >= FileVersion( 0, 4, 9 ) )
{
int64_t refTime = 0; int64_t refTime = 0;
if( ptr->continuous ) if( ptr->continuous )
{ {
@ -378,49 +372,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read( &ptr->frames[j].frameImage, sizeof( int32_t ) ); f.Read( &ptr->frames[j].frameImage, sizeof( int32_t ) );
} }
} }
}
else if( fileVer >= FileVersion( 0, 4, 2 ) )
{
int64_t refTime = 0;
if( ptr->continuous )
{
for( uint64_t j=0; j<fsz; j++ )
{
ptr->frames[j].start = ReadTimeOffset( f, refTime );
ptr->frames[j].end = -1;
ptr->frames[j].frameImage = -1;
}
}
else
{
for( uint64_t j=0; j<fsz; j++ )
{
ptr->frames[j].start = ReadTimeOffset( f, refTime );
ptr->frames[j].end = ReadTimeOffset( f, refTime );
ptr->frames[j].frameImage = -1;
}
}
}
else
{
if( ptr->continuous )
{
for( uint64_t j=0; j<fsz; j++ )
{
f.Read( &ptr->frames[j].start, sizeof( int64_t ) );
ptr->frames[j].end = -1;
ptr->frames[j].frameImage = -1;
}
}
else
{
for( uint64_t j=0; j<fsz; j++ )
{
f.Read2( ptr->frames[j].start, ptr->frames[j].end );
ptr->frames[j].frameImage = -1;
}
}
}
for( uint64_t j=0; j<fsz; j++ ) for( uint64_t j=0; j<fsz; j++ )
{ {
const auto timeSpan = GetFrameTime( *ptr, j ); const auto timeSpan = GetFrameTime( *ptr, j );
@ -632,17 +583,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
{ {
f.Read2( lockmap.timeAnnounce, lockmap.timeTerminate ); f.Read2( lockmap.timeAnnounce, lockmap.timeTerminate );
} }
else if( fileVer >= FileVersion( 0, 4, 1 ) ) else
{ {
f.Read2( lockmap.timeAnnounce, lockmap.timeTerminate ); f.Read2( lockmap.timeAnnounce, lockmap.timeTerminate );
lockmap.timeAnnounce -= m_data.baseTime; lockmap.timeAnnounce -= m_data.baseTime;
lockmap.timeTerminate -= m_data.baseTime; lockmap.timeTerminate -= m_data.baseTime;
if( lockmap.timeTerminate < lockmap.timeAnnounce ) lockmap.timeTerminate = 0; if( lockmap.timeTerminate < lockmap.timeAnnounce ) lockmap.timeTerminate = 0;
} }
else
{
lockmap.timeAnnounce = lockmap.timeTerminate = 0;
}
f.Read( tsz ); f.Read( tsz );
lockmap.threadMap.reserve( tsz ); lockmap.threadMap.reserve( tsz );
lockmap.threadList.reserve( tsz ); lockmap.threadList.reserve( tsz );
@ -690,7 +637,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
} }
} }
} }
else if( fileVer >= FileVersion( 0, 4, 2 ) ) else
{ {
int64_t refTime = lockmap.timeAnnounce; int64_t refTime = lockmap.timeAnnounce;
if( lockmap.type == LockType::Lockable ) if( lockmap.type == LockType::Lockable )
@ -724,41 +671,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
} }
} }
} }
else
{
if( lockmap.type == LockType::Lockable )
{
for( uint64_t i=0; i<tsz; i++ )
{
auto lev = m_slab.Alloc<LockEvent>();
int64_t time;
int32_t srcloc;
f.Read2( time, srcloc );
const auto lt = time - m_data.baseTime;
lev->SetTime( lt );
lev->SetSrcLoc( int16_t( srcloc ) );
f.Read( &lev->thread, sizeof( LockEvent::thread ) + sizeof( LockEvent::type ) );
*ptr++ = { lev };
UpdateLockRange( lockmap, *lev, lt );
}
}
else
{
for( uint64_t i=0; i<tsz; i++ )
{
auto lev = m_slab.Alloc<LockEventShared>();
int64_t time;
int32_t srcloc;
f.Read2( time, srcloc );
const auto lt = time - m_data.baseTime;
lev->SetTime( lt );
lev->SetSrcLoc( int16_t( srcloc ) );
f.Read( &lev->thread, sizeof( LockEventShared::thread ) + sizeof( LockEventShared::type ) );
*ptr++ = { lev };
UpdateLockRange( lockmap, *lev, lt );
}
}
}
UpdateLockCount( lockmap, 0 ); UpdateLockCount( lockmap, 0 );
m_data.lockMap.emplace( id, lockmapPtr ); m_data.lockMap.emplace( id, lockmapPtr );
} }
@ -778,11 +690,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Skip( sizeof( uint32_t ) + sizeof( int32_t ) ); f.Skip( sizeof( uint32_t ) + sizeof( int32_t ) );
} }
f.Read( type ); f.Read( type );
f.Skip( sizeof( LockMap::valid ) ); f.Skip( sizeof( LockMap::valid ) + sizeof( LockMap::timeAnnounce ) + sizeof( LockMap::timeTerminate ) );
if( fileVer >= FileVersion( 0, 4, 1 ) )
{
f.Skip( sizeof( LockMap::timeAnnounce ) + sizeof( LockMap::timeTerminate ) );
}
f.Read( tsz ); f.Read( tsz );
f.Skip( tsz * sizeof( uint64_t ) ); f.Skip( tsz * sizeof( uint64_t ) );
f.Read( tsz ); f.Read( tsz );
@ -833,7 +741,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
msgMap.emplace( ptr, msgdata ); msgMap.emplace( ptr, msgdata );
} }
} }
else if( fileVer >= FileVersion( 0, 4, 8 ) ) else
{ {
int64_t refTime = -m_data.baseTime; int64_t refTime = -m_data.baseTime;
for( uint64_t i=0; i<sz; i++ ) for( uint64_t i=0; i<sz; i++ )
@ -848,37 +756,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
msgMap.emplace( ptr, msgdata ); msgMap.emplace( ptr, msgdata );
} }
} }
else if( fileVer >= FileVersion( 0, 4, 2 ) )
{
int64_t refTime = -m_data.baseTime;
for( uint64_t i=0; i<sz; i++ )
{
uint64_t ptr;
f.Read( ptr );
auto msgdata = m_slab.Alloc<MessageData>();
msgdata->time = ReadTimeOffset( f, refTime );
f.Read( msgdata->ref );
msgdata->color = 0xFFFFFFFF;
msgdata->callstack.SetVal( 0 );
m_data.messages[i] = msgdata;
msgMap.emplace( ptr, msgdata );
}
}
else
{
for( uint64_t i=0; i<sz; i++ )
{
uint64_t ptr;
f.Read( ptr );
auto msgdata = m_slab.Alloc<MessageData>();
f.Read( msgdata, sizeof( MessageData::time ) + sizeof( MessageData::ref ) );
msgdata->time -= m_data.baseTime;
msgdata->color = 0xFFFFFFFF;
msgdata->callstack.SetVal( 0 );
m_data.messages[i] = msgdata;
msgMap.emplace( ptr, msgdata );
}
}
} }
else else
{ {
@ -886,23 +763,16 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
{ {
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) + sizeof( MessageData::color ) + sizeof( MessageData::callstack ) ) ); f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) + sizeof( MessageData::color ) + sizeof( MessageData::callstack ) ) );
} }
else if( fileVer >= FileVersion( 0, 4, 8 ) )
{
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) + sizeof( MessageData::color ) ) );
}
else else
{ {
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) ) ); f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) + sizeof( MessageData::color ) ) );
} }
} }
s_loadProgress.progress.store( LoadProgress::Zones, std::memory_order_relaxed ); s_loadProgress.progress.store( LoadProgress::Zones, std::memory_order_relaxed );
if( fileVer >= FileVersion( 0, 4, 7 ) )
{
f.Read( sz ); f.Read( sz );
s_loadProgress.subTotal.store( sz, std::memory_order_relaxed ); s_loadProgress.subTotal.store( sz, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed ); s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
}
if( fileVer >= FileVersion( 0, 5, 10 ) ) if( fileVer >= FileVersion( 0, 5, 10 ) )
{ {
f.Read( sz ); f.Read( sz );
@ -918,18 +788,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
uint64_t tid, tsz; uint64_t tid, tsz;
f.Read3( tid, td->count, tsz ); f.Read3( tid, td->count, tsz );
td->id = tid; td->id = tid;
if( fileVer < FileVersion( 0, 4, 7 ) )
{
s_loadProgress.subTotal.store( td->count, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
}
if( tsz != 0 ) if( tsz != 0 )
{ {
if( fileVer <= FileVersion( 0, 4, 1 ) ) if( fileVer <= FileVersion( 0, 5, 9 ) )
{
ReadTimelinePre042( f, td->timeline, tsz, fileVer );
}
else if( fileVer <= FileVersion( 0, 5, 9 ) )
{ {
int64_t refTime = 0; int64_t refTime = 0;
ReadTimelinePre0510( f, td->timeline, tsz, refTime, fileVer ); ReadTimelinePre0510( f, td->timeline, tsz, refTime, fileVer );
@ -964,12 +825,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
} }
s_loadProgress.progress.store( LoadProgress::GpuZones, std::memory_order_relaxed ); s_loadProgress.progress.store( LoadProgress::GpuZones, std::memory_order_relaxed );
if( fileVer >= FileVersion( 0, 4, 7 ) )
{
f.Read( sz ); f.Read( sz );
s_loadProgress.subTotal.store( sz, std::memory_order_relaxed ); s_loadProgress.subTotal.store( sz, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed ); s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
}
if( fileVer >= FileVersion( 0, 5, 10 ) ) if( fileVer >= FileVersion( 0, 5, 10 ) )
{ {
f.Read( sz ); f.Read( sz );
@ -983,11 +841,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
{ {
auto ctx = m_slab.AllocInit<GpuCtxData>(); auto ctx = m_slab.AllocInit<GpuCtxData>();
f.Read4( ctx->thread, ctx->accuracyBits, ctx->count, ctx->period ); f.Read4( ctx->thread, ctx->accuracyBits, ctx->count, ctx->period );
if( fileVer < FileVersion( 0, 4, 7 ) )
{
s_loadProgress.subTotal.store( ctx->count, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
}
if( fileVer >= FileVersion( 0, 5, 10 ) ) if( fileVer >= FileVersion( 0, 5, 10 ) )
{ {
uint64_t tdsz; uint64_t tdsz;
@ -1052,15 +905,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read2( pd->type, pd->format ); f.Read2( pd->type, pd->format );
} }
else else
{
if( fileVer >= FileVersion( 0, 4, 5 ) )
{ {
f.Read( pd->type ); f.Read( pd->type );
}
else
{
pd->type = PlotType::User;
}
switch( pd->type ) switch( pd->type )
{ {
case PlotType::User: case PlotType::User:
@ -1089,7 +935,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read( pd->data[j].val ); f.Read( pd->data[j].val );
} }
} }
else if( fileVer >= FileVersion( 0, 4, 2 ) ) else
{ {
int64_t refTime = -m_data.baseTime; int64_t refTime = -m_data.baseTime;
for( uint64_t j=0; j<psz; j++ ) for( uint64_t j=0; j<psz; j++ )
@ -1098,16 +944,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read( pd->data[j].val ); f.Read( pd->data[j].val );
} }
} }
else
{
for( uint64_t j=0; j<psz; j++ )
{
uint64_t t;
f.Read2( t, pd->data[j].val );
t -= m_data.baseTime;
pd->data[j].time.SetVal( t );
}
}
m_data.plots.Data().push_back_no_space_check( pd ); m_data.plots.Data().push_back_no_space_check( pd );
} }
} }
@ -1119,13 +955,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
{ {
f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::type ) + sizeof( PlotData::format ) ); f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::type ) + sizeof( PlotData::format ) );
} }
else if( fileVer >= FileVersion( 0, 4, 5 ) )
{
f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::type ) );
}
else else
{ {
f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) ); f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::type ) );
} }
uint64_t psz; uint64_t psz;
f.Read( psz ); f.Read( psz );
@ -1220,7 +1052,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
mem++; mem++;
} }
} }
else if( fileVer >= FileVersion( 0, 4, 4 ) ) else
{ {
auto& frees = m_data.memory.frees; auto& frees = m_data.memory.frees;
auto& active = m_data.memory.active; auto& active = m_data.memory.active;
@ -1258,85 +1090,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
mem++; mem++;
} }
} }
else
{
for( uint64_t i=0; i<sz; i++ )
{
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
uint64_t ptr;
if( fileVer > FileVersion( 0, 4, 1 ) )
{
uint64_t size;
int64_t timeAlloc, timeFree;
f.Read4( ptr, size, timeAlloc, timeFree );
mem->SetPtr( ptr );
mem->SetSize( size );
Int24 csAlloc;
f.Read( &csAlloc, sizeof( csAlloc ) );
mem->SetCsAlloc( csAlloc.Val() );
f.Skip( 1 );
f.Read( mem->csFree );
f.Skip( 1 );
refTime += timeAlloc;
mem->SetTimeAlloc( refTime - m_data.baseTime );
if( timeFree >= 0 )
{
mem->SetTimeFree( timeFree + refTime - m_data.baseTime );
}
else
{
mem->SetTimeFree( timeFree );
}
}
else
{
uint64_t ptr, size;
int64_t timeAlloc, timeFree;
f.Read4( ptr, size, timeAlloc, timeFree );
mem->SetPtr( ptr );
mem->SetSize( size );
Int24 csAlloc;
f.Read( &csAlloc, sizeof( csAlloc ) );
mem->SetCsAlloc( csAlloc.Val() );
f.Skip( 1 );
f.Read( mem->csFree );
f.Skip( 1 );
mem->SetTimeAlloc( timeAlloc - m_data.baseTime );
if( timeFree >= 0 )
{
mem->SetTimeFree( timeFree - m_data.baseTime );
}
else
{
mem->SetTimeFree( timeFree );
}
}
uint64_t t0, t1;
f.Read2( t0, t1 );
const auto ct0 = CompressThread( t0 );
mem->SetThreadAlloc( ct0 );
if( t0 == t1 )
{
mem->SetThreadFree( ct0 );
}
else
{
mem->SetThreadFree( CompressThread( t1 ) );
}
if( mem->TimeFree() < 0 )
{
m_data.memory.active.emplace( ptr, i );
}
else
{
m_data.memory.frees[fidx++] = i;
}
mem++;
}
}
f.Read3( m_data.memory.high, m_data.memory.low, m_data.memory.usage ); f.Read3( m_data.memory.high, m_data.memory.low, m_data.memory.usage );
@ -1357,13 +1110,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
{ {
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( uint64_t ) + sizeof( uint32_t ) + sizeof( uint32_t ) + sizeof( int64_t ) * 2 + sizeof( uint16_t ) * 2 ) ); f.Skip( sz * ( sizeof( uint64_t ) + sizeof( uint64_t ) + sizeof( uint32_t ) + sizeof( uint32_t ) + sizeof( int64_t ) * 2 + sizeof( uint16_t ) * 2 ) );
} }
else if( fileVer >= FileVersion( 0, 4, 4 ) )
{
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( uint64_t ) + sizeof( int64_t ) + sizeof( int64_t ) + sizeof( uint32_t ) + sizeof( uint32_t ) + sizeof( uint16_t ) + sizeof( uint16_t ) ) );
}
else else
{ {
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( uint64_t ) + sizeof( int64_t ) + sizeof( int64_t ) + sizeof( uint32_t ) + sizeof( uint32_t ) + 2 * sizeof( uint64_t ) ) ); f.Skip( sz * ( sizeof( uint64_t ) + sizeof( uint64_t ) + sizeof( int64_t ) + sizeof( int64_t ) + sizeof( uint32_t ) + sizeof( uint32_t ) + sizeof( uint16_t ) + sizeof( uint16_t ) ) );
} }
f.Skip( sizeof( MemData::high ) + sizeof( MemData::low ) + sizeof( MemData::usage ) ); f.Skip( sizeof( MemData::high ) + sizeof( MemData::low ) + sizeof( MemData::usage ) );
@ -1373,8 +1122,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
s_loadProgress.progress.store( LoadProgress::CallStacks, std::memory_order_relaxed ); s_loadProgress.progress.store( LoadProgress::CallStacks, std::memory_order_relaxed );
f.Read( sz ); f.Read( sz );
m_data.callstackPayload.reserve( sz ); m_data.callstackPayload.reserve( sz );
if( fileVer >= FileVersion( 0, 4, 6 ) )
{
for( uint64_t i=0; i<sz; i++ ) for( uint64_t i=0; i<sz; i++ )
{ {
uint8_t csz; uint8_t csz;
@ -1391,31 +1138,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.callstackPayload.push_back_no_space_check( arr ); m_data.callstackPayload.push_back_no_space_check( arr );
} }
}
else
{
for( uint64_t i=0; i<sz; i++ )
{
uint8_t csz;
f.Read( csz );
const auto memsize = sizeof( VarArray<CallstackFrameId> ) + csz * sizeof( CallstackFrameId );
auto mem = (char*)m_slab.AllocRaw( memsize );
auto data = (CallstackFrameId*)mem;
for( uint8_t j=0; j<csz; j++ )
{
uint64_t ptr;
f.Read( ptr );
data[j] = PackPointer( ptr );
}
auto arr = (VarArray<CallstackFrameId>*)( mem + csz * sizeof( CallstackFrameId ) );
new(arr) VarArray<CallstackFrameId>( csz, data );
m_data.callstackPayload.push_back_no_space_check( arr );
}
}
if( fileVer >= FileVersion( 0, 5, 8 ) ) if( fileVer >= FileVersion( 0, 5, 8 ) )
{ {
@ -1433,7 +1155,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.callstackFrameMap.emplace( id, frameData ); m_data.callstackFrameMap.emplace( id, frameData );
} }
} }
else if( fileVer >= FileVersion( 0, 4, 6 ) ) else
{ {
f.Read( sz ); f.Read( sz );
m_data.callstackFrameMap.reserve( sz ); m_data.callstackFrameMap.reserve( sz );
@ -1457,66 +1179,14 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.callstackFrameMap.emplace( id, frameData ); m_data.callstackFrameMap.emplace( id, frameData );
} }
} }
else if( fileVer >= FileVersion( 0, 4, 3 ) )
{
f.Read( sz );
m_data.callstackFrameMap.reserve( sz );
for( uint64_t i=0; i<sz; i++ )
{
__StringIdxOld str;
uint64_t ptr;
auto frameData = m_slab.Alloc<CallstackFrameData>();
f.Read2( ptr, frameData->size );
frameData->data = m_slab.AllocInit<CallstackFrame>( frameData->size );
for( uint8_t j=0; j<frameData->size; j++ )
{
f.Read( str );
if( str.active ) frameData->data[j].name.SetIdx( str.idx );
f.Read( str );
if( str.active ) frameData->data[j].file.SetIdx( str.idx );
f.Read( frameData->data[j].line );
}
m_data.callstackFrameMap.emplace( PackPointer( ptr ), frameData );
}
}
else
{
f.Read( sz );
m_data.callstackFrameMap.reserve( sz );
for( uint64_t i=0; i<sz; i++ )
{
__StringIdxOld str;
uint64_t ptr;
f.Read( ptr );
auto frameData = m_slab.Alloc<CallstackFrameData>();
frameData->size = 1;
frameData->data = m_slab.AllocInit<CallstackFrame>();
f.Read( str );
if( str.active ) frameData->data->name.SetIdx( str.idx );
f.Read( str );
if( str.active ) frameData->data->file.SetIdx( str.idx );
f.Read( frameData->data->line );
m_data.callstackFrameMap.emplace( PackPointer( ptr ), frameData );
}
}
if( fileVer >= FileVersion( 0, 4, 11 ) )
{
f.Read( sz ); f.Read( sz );
if( sz > 0 ) if( sz > 0 )
{ {
m_data.appInfo.reserve_exact( sz, m_slab ); m_data.appInfo.reserve_exact( sz, m_slab );
f.Read( m_data.appInfo.data(), sizeof( m_data.appInfo[0] ) * sz ); f.Read( m_data.appInfo.data(), sizeof( m_data.appInfo[0] ) * sz );
} }
}
if( fileVer >= FileVersion( 0, 4, 9 ) )
{
s_loadProgress.subTotal.store( 0, std::memory_order_relaxed ); s_loadProgress.subTotal.store( 0, std::memory_order_relaxed );
s_loadProgress.progress.store( LoadProgress::FrameImages, std::memory_order_relaxed ); s_loadProgress.progress.store( LoadProgress::FrameImages, std::memory_order_relaxed );
@ -1629,7 +1299,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Skip( fisz + sizeof( FrameImage::flip ) ); f.Skip( fisz + sizeof( FrameImage::flip ) );
} }
} }
}
if( fileVer >= FileVersion( 0, 5, 6 ) ) if( fileVer >= FileVersion( 0, 5, 6 ) )
{ {
@ -5140,25 +4809,6 @@ void Worker::ReadTimeline( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32
} }
} }
void Worker::ReadTimelinePre042( FileRead& f, ZoneEvent* zone, int fileVer )
{
uint64_t sz;
f.Read( sz );
if( sz == 0 )
{
zone->SetChild( -1 );
}
else
{
const auto child = m_data.zoneChildren.size();
zone->SetChild( child );
m_data.zoneChildren.push_back( Vector<short_ptr<ZoneEvent>>() );
Vector<short_ptr<ZoneEvent>> tmp;
ReadTimelinePre042( f, tmp, sz, fileVer );
m_data.zoneChildren[child] = std::move( tmp );
}
}
void Worker::ReadTimelinePre0510( FileRead& f, ZoneEvent* zone, int64_t& refTime, int fileVer ) void Worker::ReadTimelinePre0510( FileRead& f, ZoneEvent* zone, int64_t& refTime, int fileVer )
{ {
uint64_t sz; uint64_t sz;
@ -5286,59 +4936,6 @@ void Worker::ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint
while( ++zone != end ); while( ++zone != end );
} }
void Worker::ReadTimelinePre042( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint64_t size, int fileVer )
{
assert( fileVer <= FileVersion( 0, 4, 1 ) );
assert( size != 0 );
auto& vec = *(Vector<ZoneEvent>*)( &_vec );
vec.set_magic();
vec.reserve_exact( size, m_slab );
m_data.zonesCnt += size;
auto zone = vec.begin();
auto end = vec.end();
do
{
s_loadProgress.subProgress.fetch_add( 1, std::memory_order_relaxed );
int64_t start;
f.Read( start );
zone->SetStart( start - m_data.baseTime );
int64_t end;
f.Read( end );
if( end >= 0 ) end -= m_data.baseTime;
zone->SetEnd( end );
int16_t srcloc;
f.Read( srcloc );
zone->SetSrcLoc( srcloc );
f.Skip( 4 );
__StringIdxOld str;
f.Read( str );
if( str.active )
{
zone->text.SetIdx( str.idx );
}
else
{
new ( &zone->text ) StringIdx();
}
f.Read( zone->callstack );
f.Skip( 1 );
f.Read( str );
if( str.active )
{
zone->name.SetIdx( str.idx );
}
else
{
new ( &zone->name ) StringIdx();
}
ReadTimelinePre042( f, zone, fileVer );
#ifdef TRACY_NO_STATISTICS
CountZoneStatistics( zone );
#endif
}
while( ++zone != end );
}
void Worker::ReadTimelinePre0510( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint64_t size, int64_t& refTime, int fileVer ) void Worker::ReadTimelinePre0510( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec, uint64_t size, int64_t& refTime, int fileVer )
{ {
assert( fileVer <= FileVersion( 0, 5, 9 ) ); assert( fileVer <= FileVersion( 0, 5, 9 ) );
@ -5365,7 +4962,7 @@ void Worker::ReadTimelinePre0510( FileRead& f, Vector<short_ptr<ZoneEvent>>& _ve
int16_t srcloc; int16_t srcloc;
f.Read( srcloc ); f.Read( srcloc );
zone->SetSrcLoc( srcloc ); zone->SetSrcLoc( srcloc );
if( fileVer <= FileVersion( 0, 5, 0 ) ) if( fileVer == FileVersion( 0, 5, 0 ) )
{ {
f.Skip( 4 ); f.Skip( 4 );
} }
@ -5470,66 +5067,7 @@ void Worker::ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& _vec
{ {
s_loadProgress.subProgress.fetch_add( 1, std::memory_order_relaxed ); s_loadProgress.subProgress.fetch_add( 1, std::memory_order_relaxed );
if( fileVer <= FileVersion( 0, 4, 1 ) ) if( fileVer <= FileVersion( 0, 5, 1 ) )
{
int64_t cpuStart, cpuEnd;
f.Read2( cpuStart, cpuEnd );
cpuStart -= m_data.baseTime;
if( cpuEnd >= 0 ) cpuEnd -= m_data.baseTime;
zone->SetCpuStart( cpuStart );
zone->SetCpuEnd( cpuEnd );
int64_t gpuStart, gpuEnd;
f.Read2( gpuStart, gpuEnd );
if( gpuStart != std::numeric_limits<int64_t>::max() ) gpuStart -= m_data.baseTime;
if( gpuEnd >= 0 ) gpuEnd -= m_data.baseTime;
zone->SetGpuStart( gpuStart );
zone->SetGpuEnd( gpuEnd );
int16_t srcloc;
f.Read( srcloc );
zone->SetSrcLoc( srcloc );
f.Skip( 2 );
f.Read( zone->callstack );
f.Skip( 1 );
uint64_t thread;
f.Read( thread );
if( thread == 0 )
{
zone->SetThread( 0 );
}
else
{
zone->SetThread( CompressThread( thread ) );
}
}
else if( fileVer <= FileVersion( 0, 4, 3 ) )
{
int64_t tcpu, tgpu;
f.Read2( tcpu, tgpu );
int16_t srcloc;
f.Read( srcloc );
zone->SetSrcLoc( srcloc );
f.Skip( 2 );
f.Read( zone->callstack );
f.Skip( 1 );
refTime += tcpu;
refGpuTime += tgpu;
tgpu = refGpuTime;
if( tgpu != std::numeric_limits<int64_t>::max() ) tgpu -= m_data.baseTime;
zone->SetCpuStart( refTime - m_data.baseTime );
zone->SetGpuStart( tgpu );
uint64_t thread;
f.Read( thread );
if( thread == 0 )
{
zone->SetThread( 0 );
}
else
{
zone->SetThread( CompressThread( thread ) );
}
}
else if( fileVer <= FileVersion( 0, 5, 1 ) )
{ {
int64_t tcpu, tgpu; int64_t tcpu, tgpu;
f.Read2( tcpu, tgpu ); f.Read2( tcpu, tgpu );
@ -5570,8 +5108,7 @@ void Worker::ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& _vec
zone->SetGpuStart( refGpuTime ); zone->SetGpuStart( refGpuTime );
} }
ReadTimelinePre0510( f, zone, refTime, refGpuTime, fileVer ); ReadTimelinePre0510( f, zone, refTime, refGpuTime, fileVer );
if( fileVer > FileVersion( 0, 4, 1 ) )
{
int64_t cpuEnd = ReadTimeOffset( f, refTime ); int64_t cpuEnd = ReadTimeOffset( f, refTime );
if( cpuEnd > 0 ) cpuEnd -= m_data.baseTime; if( cpuEnd > 0 ) cpuEnd -= m_data.baseTime;
zone->SetCpuEnd( cpuEnd ); zone->SetCpuEnd( cpuEnd );
@ -5579,7 +5116,6 @@ void Worker::ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& _vec
if( gpuEnd > 0 ) gpuEnd -= m_data.baseTime; if( gpuEnd > 0 ) gpuEnd -= m_data.baseTime;
zone->SetGpuEnd( gpuEnd ); zone->SetGpuEnd( gpuEnd );
} }
}
while( ++zone != end ); while( ++zone != end );
} }

View File

@ -576,7 +576,6 @@ private:
#endif #endif
tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx ); tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx );
tracy_force_inline void ReadTimelinePre042( FileRead& f, ZoneEvent* zone, int fileVer );
tracy_force_inline void ReadTimelinePre0510( FileRead& f, ZoneEvent* zone, int64_t& refTime, int fileVer ); tracy_force_inline void ReadTimelinePre0510( FileRead& f, ZoneEvent* zone, int64_t& refTime, int fileVer );
tracy_force_inline void ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx ); tracy_force_inline void ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx );
tracy_force_inline void ReadTimelinePre0510( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int fileVer ); tracy_force_inline void ReadTimelinePre0510( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int fileVer );
@ -588,7 +587,6 @@ private:
#endif #endif
void ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int64_t& refTime, int32_t& childIdx ); void ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int64_t& refTime, int32_t& childIdx );
void ReadTimelinePre042( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int fileVer );
void ReadTimelinePre0510( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int64_t& refTime, int fileVer ); void ReadTimelinePre0510( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int64_t& refTime, int fileVer );
void ReadTimeline( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx ); void ReadTimeline( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx );
void ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int fileVer ); void ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int fileVer );