Drop support for loading pre-0.6.0 traces.

This commit is contained in:
Bartosz Taudul 2020-06-14 15:52:52 +02:00
parent 634b0933d1
commit 71359c46c1
3 changed files with 211 additions and 757 deletions

View File

@ -94,13 +94,6 @@ private:
uint8_t m_idx[3];
};
struct __StringIdxOld
{
uint32_t idx : 31;
uint32_t active : 1;
};
class Int24
{
public:

View File

@ -58,7 +58,7 @@ static bool SourceFileValid( const char* fn, uint64_t olderThan )
static const uint8_t FileHeader[8] { 't', 'r', 'a', 'c', 'y', Version::Major, Version::Minor, Version::Patch };
enum { FileHeaderMagic = 5 };
static const int CurrentVersion = FileVersion( Version::Major, Version::Minor, Version::Patch );
static const int MinSupportedVersion = FileVersion( 0, 5, 0 );
static const int MinSupportedVersion = FileVersion( 0, 6, 0 );
static void UpdateLockCountLockable( LockMap& lockmap, size_t pos )
@ -433,31 +433,10 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
}
m_traceVersion = fileVer;
if( fileVer == FileVersion( 0, 5, 0 ) )
{
s_loadProgress.total.store( 9, std::memory_order_relaxed );
}
else if( fileVer <= FileVersion( 0, 5, 2 ) )
{
s_loadProgress.total.store( 10, std::memory_order_relaxed );
}
else
{
s_loadProgress.total.store( 11, std::memory_order_relaxed );
}
s_loadProgress.subTotal.store( 0, std::memory_order_relaxed );
s_loadProgress.progress.store( LoadProgress::Initialization, std::memory_order_relaxed );
f.Read4( m_resolution, m_timerMul, m_data.lastTime, m_data.frameOffset );
if( fileVer >= FileVersion( 0, 5, 5 ) )
{
f.Read( m_pid );
}
else
{
m_pid = 0;
}
f.Read5( m_resolution, m_timerMul, m_data.lastTime, m_data.frameOffset, m_pid );
if( fileVer >= FileVersion( 0, 6, 5 ) )
{
@ -577,31 +556,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.framesBase = m_data.frames.Data()[0];
assert( m_data.framesBase->name == 0 );
if( fileVer < FileVersion( 0, 5, 2 ) )
{
m_data.baseTime = m_data.framesBase->frames[0].start;
m_data.lastTime -= m_data.baseTime;
if( m_data.crashEvent.time != 0 ) m_data.crashEvent.time -= m_data.baseTime;
for( auto& fd : m_data.frames.Data() )
{
if( fd->continuous )
{
for( auto& fe : fd->frames )
{
fe.start -= m_data.baseTime;
}
}
else
{
for( auto& fe : fd->frames )
{
fe.start -= m_data.baseTime;
fe.end -= m_data.baseTime;
}
}
}
}
unordered_flat_map<uint64_t, const char*> pointerMap;
f.Read( sz );
@ -643,8 +597,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
}
}
if( fileVer >= FileVersion( 0, 5, 3 ) )
{
f.Read( sz );
for( uint64_t i=0; i<sz; i++ )
{
@ -657,13 +609,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.externalNames.emplace( id, std::make_pair( it->second, it2->second ) );
}
}
}
m_data.localThreadCompress.Load( f, fileVer );
if( fileVer >= FileVersion( 0, 5, 6 ) )
{
m_data.externalThreadCompress.Load( f, fileVer );
}
f.Read( sz );
for( uint64_t i=0; i<sz; i++ )
@ -696,8 +644,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.sourceLocationZones.reserve( sle + sz );
f.Read( sz );
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
for( uint64_t i=0; i<sz; i++ )
{
int16_t id;
@ -707,23 +653,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
assert( status.second );
status.first->second.zones.reserve( cnt );
}
}
else
{
for( uint64_t i=0; i<sz; i++ )
{
int32_t id;
uint64_t cnt;
f.Read2( id, cnt );
auto status = m_data.sourceLocationZones.emplace( int16_t( id ), SourceLocationZones() );
assert( status.second );
status.first->second.zones.reserve( cnt );
}
}
#else
f.Read( sz );
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
for( uint64_t i=0; i<sz; i++ )
{
int16_t id;
@ -731,17 +662,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Skip( sizeof( uint64_t ) );
m_data.sourceLocationZonesCnt.emplace( id, 0 );
}
}
else
{
for( uint64_t i=0; i<sz; i++ )
{
int32_t id;
f.Read( id );
f.Skip( sizeof( uint64_t ) );
m_data.sourceLocationZonesCnt.emplace( int16_t( id ), 0 );
}
}
#endif
s_loadProgress.progress.store( LoadProgress::Locks, std::memory_order_relaxed );
@ -761,30 +681,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
{
f.Read( lockmap.customName );
}
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
f.Read( lockmap.srcloc );
}
else
{
int32_t srcloc;
f.Read( srcloc );
lockmap.srcloc = int16_t( srcloc );
}
f.Read2( lockmap.type, lockmap.valid );
f.Read6( lockmap.srcloc, lockmap.type, lockmap.valid, lockmap.timeAnnounce, lockmap.timeTerminate, tsz );
lockmap.isContended = false;
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
f.Read2( lockmap.timeAnnounce, lockmap.timeTerminate );
}
else
{
f.Read2( lockmap.timeAnnounce, lockmap.timeTerminate );
lockmap.timeAnnounce -= m_data.baseTime;
lockmap.timeTerminate -= m_data.baseTime;
if( lockmap.timeTerminate < lockmap.timeAnnounce ) lockmap.timeTerminate = 0;
}
f.Read( tsz );
lockmap.threadMap.reserve( tsz );
lockmap.threadList.reserve( tsz );
for( uint64_t i=0; i<tsz; i++ )
@ -797,8 +695,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read( tsz );
lockmap.timeline.reserve_exact( tsz, m_slab );
auto ptr = lockmap.timeline.data();
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
int64_t refTime = lockmap.timeAnnounce;
if( lockmap.type == LockType::Lockable )
{
@ -830,41 +726,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
UpdateLockRange( lockmap, *lev, lt );
}
}
}
else
{
int64_t refTime = lockmap.timeAnnounce;
if( lockmap.type == LockType::Lockable )
{
for( uint64_t i=0; i<tsz; i++ )
{
auto lev = m_slab.Alloc<LockEvent>();
const auto lt = ReadTimeOffset( f, refTime );
lev->SetTime( lt );
int32_t srcloc;
f.Read( srcloc );
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>();
const auto lt = ReadTimeOffset( f, refTime );
lev->SetTime( lt );
int32_t srcloc;
f.Read( srcloc );
lev->SetSrcLoc( int16_t( srcloc ) );
f.Read( &lev->thread, sizeof( LockEventShared::thread ) + sizeof( LockEventShared::type ) );
*ptr++ = { lev };
UpdateLockRange( lockmap, *lev, lt );
}
}
}
UpdateLockCount( lockmap, 0 );
m_data.lockMap.emplace( id, lockmapPtr );
}
@ -879,28 +740,14 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
{
f.Skip( sizeof( LockMap::customName ) );
}
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
f.Skip( sizeof( uint32_t ) + sizeof( LockMap::srcloc ) );
}
else
{
f.Skip( sizeof( uint32_t ) + sizeof( int32_t ) );
}
f.Read( type );
f.Skip( sizeof( LockMap::valid ) + sizeof( LockMap::timeAnnounce ) + sizeof( LockMap::timeTerminate ) );
f.Read( tsz );
f.Skip( tsz * sizeof( uint64_t ) );
f.Read( tsz );
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
f.Skip( tsz * ( sizeof( int64_t ) + sizeof( int16_t ) + sizeof( LockEvent::thread ) + sizeof( LockEvent::type ) ) );
}
else
{
f.Skip( tsz * ( sizeof( int64_t ) + sizeof( int32_t ) + sizeof( LockEvent::thread ) + sizeof( LockEvent::type ) ) );
}
}
}
s_loadProgress.subTotal.store( 0, std::memory_order_relaxed );
@ -910,8 +757,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
if( eventMask & EventType::Messages )
{
m_data.messages.reserve_exact( sz, m_slab );
if( fileVer >= FileVersion( 0, 5, 12 ) )
{
int64_t refTime = 0;
for( uint64_t i=0; i<sz; i++ )
{
@ -924,48 +769,10 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
msgMap.emplace( ptr, msgdata );
}
}
else if( fileVer >= FileVersion( 0, 5, 2 ) )
{
int64_t refTime = 0;
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.Read2( msgdata->ref, msgdata->color );
msgdata->callstack.SetVal( 0 );
m_data.messages[i] = msgdata;
msgMap.emplace( ptr, msgdata );
}
}
else
{
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.Read2( msgdata->ref, msgdata->color );
msgdata->callstack.SetVal( 0 );
m_data.messages[i] = msgdata;
msgMap.emplace( ptr, msgdata );
}
}
}
else
{
if( fileVer >= FileVersion( 0, 5, 12 ) )
{
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) + sizeof( MessageData::color ) + sizeof( MessageData::callstack ) ) );
}
else
{
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) + sizeof( MessageData::color ) ) );
}
}
if( fileVer >= FileVersion( 0, 6, 3 ) )
{
@ -983,12 +790,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read( sz );
s_loadProgress.subTotal.store( sz, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
if( fileVer >= FileVersion( 0, 5, 10 ) )
{
f.Read( sz );
m_data.zoneChildren.reserve_exact( sz, m_slab );
memset( m_data.zoneChildren.data(), 0, sizeof( Vector<short_ptr<ZoneEvent>> ) * sz );
}
int32_t childIdx = 0;
f.Read( sz );
m_data.threads.reserve_exact( sz, m_slab );
@ -1070,12 +874,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read( sz );
s_loadProgress.subTotal.store( sz, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
if( fileVer >= FileVersion( 0, 5, 10 ) )
{
f.Read( sz );
m_data.gpuChildren.reserve_exact( sz, m_slab );
memset( m_data.gpuChildren.data(), 0, sizeof( Vector<short_ptr<GpuEvent>> ) * sz );
}
childIdx = 0;
f.Read( sz );
m_data.gpuData.reserve_exact( sz, m_slab );
@ -1092,8 +893,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
ctx->type = ctx->thread == 0 ? GpuContextType::Vulkan : GpuContextType::OpenGl;
}
m_data.gpuCnt += ctx->count;
if( fileVer >= FileVersion( 0, 5, 10 ) )
{
uint64_t tdsz;
f.Read( tdsz );
for( uint64_t j=0; j<tdsz; j++ )
@ -1108,36 +907,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
ReadTimeline( f, td->second.timeline, tsz, refTime, refGpuTime, childIdx );
}
}
}
else if( fileVer >= FileVersion( 0, 5, 7 ) )
{
uint64_t tdsz;
f.Read( tdsz );
for( uint64_t j=0; j<tdsz; j++ )
{
uint64_t tid, tsz;
f.Read2( tid, tsz );
if( tsz != 0 )
{
int64_t refTime = 0;
int64_t refGpuTime = 0;
auto td = ctx->threadData.emplace( tid, GpuCtxThreadData {} ).first;
ReadTimelinePre0510( f, td->second.timeline, tsz, refTime, refGpuTime, fileVer );
}
}
}
else
{
uint64_t tsz;
f.Read( tsz );
if( tsz != 0 )
{
int64_t refTime = 0;
int64_t refGpuTime = 0;
auto td = ctx->threadData.emplace( 0, GpuCtxThreadData {} ).first;
ReadTimelinePre0510( f, td->second.timeline, tsz, refTime, refGpuTime, fileVer );
}
}
m_data.gpuData[i] = ctx;
}
@ -1151,34 +920,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
{
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
auto pd = m_slab.AllocInit<PlotData>();
if( fileVer >= FileVersion( 0, 5, 11 ) )
{
f.Read2( pd->type, pd->format );
}
else
{
f.Read( pd->type );
switch( pd->type )
{
case PlotType::User:
pd->format = PlotValueFormatting::Number;
break;
case PlotType::Memory:
pd->format = PlotValueFormatting::Memory;
break;
case PlotType::SysTime:
pd->format = PlotValueFormatting::Percentage;
break;
default:
assert( false );
break;
}
}
uint64_t psz;
f.Read4( pd->name, pd->min, pd->max, psz );
f.Read6( pd->type, pd->format, pd->name, pd->min, pd->max, psz );
pd->data.reserve_exact( psz, m_slab );
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
auto ptr = pd->data.data();
int64_t refTime = 0;
for( uint64_t j=0; j<psz; j++ )
@ -1189,31 +933,14 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
ptr->time = refTime;
ptr++;
}
}
else
{
int64_t refTime = -m_data.baseTime;
for( uint64_t j=0; j<psz; j++ )
{
pd->data[j].time.SetVal( ReadTimeOffset( f, refTime ) );
f.Read( pd->data[j].val );
}
}
m_data.plots.Data().push_back_no_space_check( pd );
}
}
else
{
for( uint64_t i=0; i<sz; i++ )
{
if( fileVer >= FileVersion( 0, 5, 11 ) )
{
f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::type ) + sizeof( PlotData::format ) );
}
else
{
f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::type ) );
}
uint64_t psz;
f.Read( psz );
f.Skip( psz * ( sizeof( uint64_t ) + sizeof( double ) ) );
@ -1236,8 +963,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
s_loadProgress.subTotal.store( sz, std::memory_order_relaxed );
size_t fidx = 0;
int64_t refTime = 0;
if( fileVer >= FileVersion( 0, 5, 9 ) )
{
auto& frees = m_data.memory.frees;
auto& active = m_data.memory.active;
@ -1266,83 +991,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
}
mem++;
}
}
else if( fileVer >= FileVersion( 0, 5, 2 ) )
{
auto& frees = m_data.memory.frees;
auto& active = m_data.memory.active;
for( uint64_t i=0; i<sz; i++ )
{
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
uint64_t ptr, size;
Int24 csAlloc;
f.Read3( ptr, size, csAlloc );
mem->SetPtr( ptr );
mem->SetSize( size );
mem->SetCsAlloc( csAlloc.Val() );
f.Skip( 1 );
f.Read( &mem->csFree, sizeof( MemEvent::csFree ) );
f.Skip( 1 );
int64_t timeAlloc, timeFree;
uint16_t threadAlloc, threadFree;
f.Read4( timeAlloc, timeFree, threadAlloc, threadFree );
refTime += timeAlloc;
mem->SetTimeAlloc( refTime );
if( timeFree >= 0 )
{
mem->SetTimeFree( timeFree + refTime );
frees[fidx++] = i;
}
else
{
mem->SetTimeFree( timeFree );
active.emplace( ptr, i );
}
mem->SetThreadAlloc( threadAlloc );
mem->SetThreadFree( threadFree );
mem++;
}
}
else
{
auto& frees = m_data.memory.frees;
auto& active = m_data.memory.active;
for( uint64_t i=0; i<sz; i++ )
{
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
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 );
uint16_t threadAlloc, threadFree;
f.Read2( threadAlloc, threadFree );
refTime += timeAlloc;
mem->SetTimeAlloc( refTime - m_data.baseTime );
if( timeFree >= 0 )
{
mem->SetTimeFree( timeFree + refTime - m_data.baseTime );
frees[fidx++] = i;
}
else
{
mem->SetTimeFree( timeFree );
active.emplace( ptr, i );
}
mem->SetThreadAlloc( threadAlloc );
mem->SetThreadFree( threadFree );
mem++;
}
}
f.Read3( m_data.memory.high, m_data.memory.low, m_data.memory.usage );
if( sz != 0 )
@ -1353,20 +1001,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
else
{
f.Skip( 2 * sizeof( uint64_t ) );
if( fileVer >= FileVersion( 0, 5, 9 ) )
{
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( uint64_t ) + sizeof( Int24 ) + sizeof( Int24 ) + sizeof( int64_t ) * 2 + sizeof( uint16_t ) * 2 ) );
}
else if( fileVer >= FileVersion( 0, 5, 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
{
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 ) );
}
@ -1429,7 +1064,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.callstackFrameMap.emplace( id, frameData );
}
}
else if( fileVer >= FileVersion( 0, 5, 8 ) )
else
{
f.Read( sz );
m_data.callstackFrameMap.reserve( sz );
@ -1449,31 +1084,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
m_data.callstackFrameMap.emplace( id, frameData );
}
}
else
{
f.Read( sz );
m_data.callstackFrameMap.reserve( sz );
for( uint64_t i=0; i<sz; i++ )
{
__StringIdxOld str;
CallstackFrameId id;
auto frameData = m_slab.AllocInit<CallstackFrameData>();
f.Read2( id, 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 );
frameData->data[j].symAddr = 0;
}
m_data.callstackFrameMap.emplace( id, frameData );
}
}
f.Read( sz );
if( sz > 0 )
@ -1598,8 +1208,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
}
}
if( fileVer >= FileVersion( 0, 5, 6 ) )
{
s_loadProgress.subTotal.store( 0, std::memory_order_relaxed );
s_loadProgress.progress.store( LoadProgress::ContextSwitches, std::memory_order_relaxed );
@ -1708,7 +1316,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read2( tid, data );
m_data.cpuThreadData.emplace( tid, data );
}
}
if( fileVer >= FileVersion( 0, 6, 7 ) )
{
@ -6470,24 +6077,12 @@ void Worker::ReadTimelinePre063( FileRead& f, ZoneEvent* zone, int64_t& refTime,
zone->SetChild( -1 );
}
else
{
if( fileVer >= FileVersion( 0, 5, 10 ) )
{
const auto idx = childIdx;
childIdx++;
zone->SetChild( idx );
ReadTimelinePre063( f, m_data.zoneChildren[idx], sz, refTime, childIdx, fileVer );
}
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;
ReadTimelinePre063( f, tmp, sz, refTime, childIdx, fileVer );
m_data.zoneChildren[child] = std::move( tmp );
}
}
}
void Worker::ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx )
@ -6512,25 +6107,6 @@ void Worker::ReadTimelineHaveSize( FileRead& f, GpuEvent* zone, int64_t& refTime
}
}
void Worker::ReadTimelinePre0510( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int fileVer )
{
uint64_t sz;
f.Read( sz );
if( sz == 0 )
{
zone->SetChild( -1 );
}
else
{
const auto child = m_data.gpuChildren.size();
zone->SetChild( child );
m_data.gpuChildren.push_back( Vector<short_ptr<GpuEvent>>() );
Vector<short_ptr<GpuEvent>> tmp;
ReadTimelinePre0510( f, tmp, sz, refTime, refGpuTime, fileVer );
m_data.gpuChildren[child] = std::move( tmp );
}
}
#ifndef TRACY_NO_STATISTICS
void Worker::ReconstructZoneStatistics( ZoneEvent& zone, uint16_t thread )
{
@ -6629,64 +6205,15 @@ void Worker::ReadTimelinePre063( FileRead& f, Vector<short_ptr<ZoneEvent>>& _vec
auto zone = vec.begin();
auto end = vec.end();
do
{
if( fileVer >= FileVersion( 0, 5, 2 ) )
{
int16_t srcloc;
f.Read( srcloc );
zone->SetSrcLoc( srcloc );
f.Read( &zone->_end_child1, sizeof( zone->_end_child1 ) );
}
else
{
f.Read( &zone->_end_child1, sizeof( zone->_end_child1 ) );
int16_t srcloc;
f.Read( srcloc );
zone->SetSrcLoc( srcloc );
if( fileVer == FileVersion( 0, 5, 0 ) )
{
f.Skip( 4 );
}
else
{
f.Skip( 2 );
}
}
ZoneExtra extra;
if( fileVer <= FileVersion( 0, 5, 7 ) )
{
__StringIdxOld str;
f.Read( str );
if( str.active )
{
extra.text.SetIdx( str.idx );
}
else
{
new ( &extra.text ) StringIdx();
}
f.Read( extra.callstack );
f.Skip( 1 );
f.Read( str );
if( str.active )
{
extra.name.SetIdx( str.idx );
}
else
{
new ( &extra.name ) StringIdx();
}
}
else
{
f.Read( &extra.text, sizeof( extra.text ) );
f.Read( &extra.callstack, sizeof( extra.callstack ) );
if( fileVer <= FileVersion( 0, 5, 8 ) )
{
f.Skip( 1 );
}
f.Read( &extra.name, sizeof( extra.name ) );
}
zone->extra = 0;
if( extra.callstack.Val() != 0 || extra.name.Active() || extra.text.Active() )
{
@ -6740,70 +6267,6 @@ void Worker::ReadTimeline( FileRead& f, Vector<short_ptr<GpuEvent>>& _vec, uint6
while( ++zone != end );
}
void Worker::ReadTimelinePre0510( FileRead& f, Vector<short_ptr<GpuEvent>>& _vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int fileVer )
{
assert( size != 0 );
const auto lp = s_loadProgress.subProgress.load( std::memory_order_relaxed );
s_loadProgress.subProgress.store( lp + size, std::memory_order_relaxed );
auto& vec = *(Vector<GpuEvent>*)( &_vec );
vec.set_magic();
vec.reserve_exact( size, m_slab );
auto zone = vec.begin();
auto end = vec.end();
do
{
if( fileVer <= FileVersion( 0, 5, 1 ) )
{
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 );
uint16_t thread;
f.Read( thread );
zone->SetThread( thread );
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 );
}
else
{
int64_t tcpu, tgpu;
f.Read2( tcpu, tgpu );
int16_t srcloc;
f.Read( srcloc );
zone->SetSrcLoc( srcloc );
f.Read( &zone->callstack, sizeof( zone->callstack ) );
if( fileVer <= FileVersion( 0, 5, 8 ) )
{
f.Skip( 1 );
}
uint16_t thread;
f.Read( thread );
zone->SetThread( thread );
refTime += tcpu;
refGpuTime += tgpu;
zone->SetCpuStart( refTime );
zone->SetGpuStart( refGpuTime );
}
ReadTimelinePre0510( f, zone, refTime, refGpuTime, fileVer );
int64_t cpuEnd = ReadTimeOffset( f, refTime );
if( cpuEnd > 0 ) cpuEnd -= m_data.baseTime;
zone->SetCpuEnd( cpuEnd );
int64_t gpuEnd = ReadTimeOffset( f, refGpuTime );
if( gpuEnd > 0 ) gpuEnd -= m_data.baseTime;
zone->SetGpuEnd( gpuEnd );
}
while( ++zone != end );
}
void Worker::Disconnect()
{
Query( ServerQueryDisconnect, 0 );

View File

@ -775,7 +775,6 @@ private:
tracy_force_inline void ReadTimelinePre063( FileRead& f, ZoneEvent* zone, int64_t& refTime, int32_t& childIdx, int fileVer );
tracy_force_inline void ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx );
tracy_force_inline void ReadTimelineHaveSize( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int32_t& childIdx, uint64_t sz );
tracy_force_inline void ReadTimelinePre0510( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int fileVer );
#ifndef TRACY_NO_STATISTICS
tracy_force_inline void ReconstructZoneStatistics( ZoneEvent& zone, uint16_t thread );
@ -792,7 +791,6 @@ private:
int64_t ReadTimeline( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint32_t size, int64_t refTime, int32_t& childIdx );
void ReadTimelinePre063( FileRead& f, Vector<short_ptr<ZoneEvent>>& vec, uint64_t size, int64_t& refTime, int32_t& childIdx, int fileVer );
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 );
tracy_force_inline void WriteTimeline( FileWrite& f, const Vector<short_ptr<ZoneEvent>>& vec, int64_t& refTime );
tracy_force_inline void WriteTimeline( FileWrite& f, const Vector<short_ptr<GpuEvent>>& vec, int64_t& refTime, int64_t& refGpuTime );