From bae7fb3e882838ae49d5843284eed6064f75cfd8 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 28 Oct 2022 00:14:06 +0200 Subject: Drop support for 0.7.x traces. --- server/TracyWorker.cpp | 429 ++++++++++++------------------------------------- 1 file changed, 102 insertions(+), 327 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index fd04ab8a..7faed90e 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -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, 7, 0 ); +static const int MinSupportedVersion = FileVersion( 0, 8, 0 ); static void UpdateLockCountLockable( LockMap& lockmap, size_t pos ) @@ -606,14 +606,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) m_captureProgram = std::string( tmp, tmp+sz ); f.Read( m_captureTime ); } - if( fileVer >= FileVersion( 0, 7, 6 ) ) - { - f.Read( m_executableTime ); - } - else - { - m_executableTime = 0; - } + + f.Read( m_executableTime ); + { f.Read( sz ); assert( sz < 1024 ); @@ -792,18 +787,15 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) status.first->second.zones.reserve( cnt ); } - if( fileVer >= FileVersion( 0, 7, 15 ) ) + f.Read( sz ); + for( uint64_t i=0; isecond.zones.reserve( cnt ); - } + int16_t id; + uint64_t cnt; + f.Read2( id, cnt ); + auto status = m_data.gpuSourceLocationZones.emplace( id, GpuSourceLocationZones() ); + assert( status.second ); + status.first->second.zones.reserve( cnt ); } #else f.Read( sz ); @@ -815,16 +807,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) m_data.sourceLocationZonesCnt.emplace( id, 0 ); } - if( fileVer >= FileVersion( 0, 7, 15 ) ) + f.Read( sz ); + for( uint64_t i=0; i= FileVersion( 0, 7, 5 ) ) - { - f.Read( sz ); - assert( sz != 0 ); - m_data.zoneExtra.reserve_exact( sz, m_slab ); - f.Read( m_data.zoneExtra.data(), sz * sizeof( ZoneExtra ) ); - } - else - { - f.Read( sz ); - assert( sz != 0 ); - m_data.zoneExtra.reserve_exact( sz, m_slab ); - for( uint64_t i=0; icallstack, zoneExtra->text, zoneExtra->name ); - zoneExtra->color = 0; - } - } + f.Read( sz ); + assert( sz != 0 ); + m_data.zoneExtra.reserve_exact( sz, m_slab ); + f.Read( m_data.zoneExtra.data(), sz * sizeof( ZoneExtra ) ); s_loadProgress.progress.store( LoadProgress::Zones, std::memory_order_relaxed ); f.Read( sz ); @@ -963,21 +937,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) { auto td = m_slab.AllocInit(); uint64_t tid; - if( fileVer >= FileVersion( 0, 7, 11 ) ) - { - f.Read4( tid, td->count, td->kernelSampleCnt, td->isFiber ); - } - else if( fileVer >= FileVersion( 0, 7, 9 ) ) - { - f.Read3( tid, td->count, td->kernelSampleCnt ); - td->isFiber = 0; - } - else - { - f.Read2( tid, td->count ); - td->kernelSampleCnt = 0; - td->isFiber = 0; - } + f.Read4( tid, td->count, td->kernelSampleCnt, td->isFiber ); td->id = tid; m_data.zonesCnt += td->count; uint32_t tsz; @@ -1005,31 +965,27 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) { f.Skip( msz * sizeof( uint64_t ) ); } - if( fileVer >= FileVersion( 0, 7, 14 ) ) + uint64_t ssz; + f.Read( ssz ); + if( ssz != 0 ) { - uint64_t ssz; - f.Read( ssz ); - if( ssz != 0 ) + if( eventMask & EventType::Samples ) { - if( eventMask & EventType::Samples ) - { - int64_t refTime = 0; - td->ctxSwitchSamples.reserve_exact( ssz, m_slab ); - auto ptr = td->ctxSwitchSamples.data(); - for( uint64_t j=0; jtime.SetVal( ReadTimeOffset( f, refTime ) ); - f.Read( &ptr->callstack, sizeof( ptr->callstack ) ); - ptr++; - } - } - else + int64_t refTime = 0; + td->ctxSwitchSamples.reserve_exact( ssz, m_slab ); + auto ptr = td->ctxSwitchSamples.data(); + for( uint64_t j=0; jtime.SetVal( ReadTimeOffset( f, refTime ) ); + f.Read( &ptr->callstack, sizeof( ptr->callstack ) ); + ptr++; } } + else + { + f.Skip( ssz * ( 8 + 3 ) ); + } } - uint64_t ssz; f.Read( ssz ); if( ssz != 0 ) { @@ -1068,33 +1024,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) for( uint64_t i=0; i(); - if( fileVer >= FileVersion( 0, 7, 9 ) ) - { - uint8_t calibration; - f.Read7( ctx->thread, calibration, ctx->count, ctx->period, ctx->type, ctx->name, ctx->overflow ); - ctx->hasCalibration = calibration; - } - else if( fileVer >= FileVersion( 0, 7, 6 ) ) - { - uint8_t calibration; - f.Read6( ctx->thread, calibration, ctx->count, ctx->period, ctx->type, ctx->name ); - ctx->hasCalibration = calibration; - ctx->overflow = 0; - } - else if( fileVer >= FileVersion( 0, 7, 1 ) ) - { - uint8_t calibration; - f.Read5( ctx->thread, calibration, ctx->count, ctx->period, ctx->type ); - ctx->hasCalibration = calibration; - ctx->overflow = 0; - } - else - { - uint8_t accuracy; - f.Read5( ctx->thread, accuracy, ctx->count, ctx->period, ctx->type ); - ctx->hasCalibration = false; - ctx->overflow = 0; - } + uint8_t calibration; + f.Read7( ctx->thread, calibration, ctx->count, ctx->period, ctx->type, ctx->name, ctx->overflow ); + ctx->hasCalibration = calibration; ctx->hasPeriod = ctx->period != 1.f; m_data.gpuCnt += ctx->count; uint64_t tdsz; @@ -1142,31 +1074,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) m_data.plots.Data().push_back_no_space_check( pd ); } } - else if( fileVer >= FileVersion( 0, 7, 10 ) ) - { - for( uint64_t i=0; i(); - uint64_t psz; - f.Read7( pd->type, pd->format, pd->name, pd->min, pd->max, pd->sum, psz ); - pd->showSteps = false; - pd->fill = true; - pd->color = 0; - pd->data.reserve_exact( psz, m_slab ); - auto ptr = pd->data.data(); - int64_t refTime = 0; - for( uint64_t j=0; jval ); - refTime += t; - ptr->time = refTime; - ptr++; - } - m_data.plots.Data().push_back_no_space_check( pd ); - } - } else { for( uint64_t i=0; i(); uint64_t psz; - f.Read6( pd->type, pd->format, pd->name, pd->min, pd->max, psz ); - pd->sum = 0; + f.Read7( pd->type, pd->format, pd->name, pd->min, pd->max, pd->sum, psz ); pd->showSteps = false; pd->fill = true; pd->color = 0; @@ -1186,7 +1092,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) { int64_t t; f.Read2( t, ptr->val ); - pd->sum += ptr->val; refTime += t; ptr->time = refTime; ptr++; @@ -1208,21 +1113,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) } } - else if( fileVer >= FileVersion( 0, 7, 10 ) ) - { - for( uint64_t i=0; i= FileVersion( 0, 7, 3 ) ) - { - uint64_t memcount, memtarget, memload = 0; - f.Read2( memcount, memtarget ); - s_loadProgress.subTotal.store( memtarget, std::memory_order_relaxed ); - - for( uint64_t k=0; k() ); - if( memname == 0 ) m_data.memory = mit.first->second; - auto& memdata = *mit.first->second; - memdata.data.reserve_exact( sz, m_slab ); - uint64_t activeSz, freesSz; - f.Read2( activeSz, freesSz ); - memdata.active.reserve( activeSz ); - memdata.frees.reserve_exact( freesSz, m_slab ); - auto mem = memdata.data.data(); - s_loadProgress.subTotal.store( sz, std::memory_order_relaxed ); - size_t fidx = 0; - int64_t refTime = 0; - auto& frees = memdata.frees; - auto& active = memdata.active; - - for( uint64_t i=0; icsFree, timeAlloc, timeFree, threadAlloc, threadFree ); - mem->SetPtr( ptr ); - mem->SetSize( size ); - mem->SetCsAlloc( csAlloc.Val() ); - refTime += timeAlloc; - mem->SetTimeThreadAlloc( refTime, threadAlloc ); - if( timeFree >= 0 ) - { - mem->SetTimeThreadFree( timeFree + refTime, threadFree ); - frees[fidx++] = i; - } - else - { - mem->SetTimeThreadFree( timeFree, threadFree ); - active.emplace( ptr, i ); - } - mem++; - } - memload += sz; - f.Read4( memdata.high, memdata.low, memdata.usage, memdata.name ); + uint64_t memcount, memtarget, memload = 0; + f.Read2( memcount, memtarget ); + s_loadProgress.subTotal.store( memtarget, std::memory_order_relaxed ); - if( sz != 0 ) - { - memdata.reconstruct = true; - } - } - else - { - f.Skip( 2 * sizeof( uint64_t ) ); - f.Skip( sz * ( sizeof( uint64_t ) + sizeof( uint64_t ) + sizeof( Int24 ) + sizeof( Int24 ) + sizeof( int64_t ) * 2 + sizeof( uint16_t ) * 2 ) ); - f.Skip( sizeof( MemData::high ) + sizeof( MemData::low ) + sizeof( MemData::usage ) + sizeof( MemData::name ) ); - } - } - } - else + for( uint64_t k=0; k(); - m_data.memNameMap.emplace( 0, m_data.memory ); - - f.Read( sz ); + uint64_t memname; + f.Read2( memname, sz ); if( eventMask & EventType::Memory ) { - auto& memdata = *m_data.memory; + auto mit = m_data.memNameMap.emplace( memname, m_slab.AllocInit() ); + if( memname == 0 ) m_data.memory = mit.first->second; + auto& memdata = *mit.first->second; memdata.data.reserve_exact( sz, m_slab ); uint64_t activeSz, freesSz; f.Read2( activeSz, freesSz ); @@ -1324,7 +1155,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) for( uint64_t i=0; i= FileVersion( 0, 7, 8 ) ) - { - uint32_t dsz; - f.Read( dsz ); - auto dict = new char[dsz]; - f.Read( dict, dsz ); - cdict = ZSTD_createCDict( dict, dsz, 3 ); - m_texcomp.SetDict( ZSTD_createDDict( dict, dsz ) ); - delete[] dict; - } + uint32_t dsz; + f.Read( dsz ); + auto dict = new char[dsz]; + f.Read( dict, dsz ); + cdict = ZSTD_createCDict( dict, dsz, 3 ); + m_texcomp.SetDict( ZSTD_createDDict( dict, dsz ) ); + delete[] dict; f.Read( sz ); m_data.frameImage.reserve_exact( sz, m_slab ); @@ -1533,12 +1362,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) } else { - if( fileVer >= FileVersion( 0, 7, 8 ) ) - { - uint32_t dsz; - f.Read( dsz ); - f.Skip( dsz ); - } + uint32_t dsz; + f.Read( dsz ); + f.Skip( dsz ); f.Read( sz ); s_loadProgress.subTotal.store( sz, std::memory_order_relaxed ); for( uint64_t i=0; iv.data(); - if( fileVer >= FileVersion( 0, 7, 12 ) ) - { - for( uint64_t j=0; jSetWakeup( refTime ); - refTime += deltaStart; - ptr->SetStartCpu( refTime, cpu ); - if( diff > 0 ) runningTime += diff; - refTime += diff; - ptr->SetEndReasonState( refTime, reason, state ); - ptr->SetThread( CompressThread( thread ) ); - ptr++; - } - } - else + for( uint64_t j=0; jSetWakeup( refTime ); - refTime += deltaStart; - ptr->SetStartCpu( refTime, cpu ); - if( diff > 0 ) runningTime += diff; - refTime += diff; - ptr->SetEndReasonState( refTime, reason, state ); - ptr->SetThread( 0 ); - ptr++; - } + int64_t deltaWakeup, deltaStart, diff, thread; + uint8_t cpu; + int8_t reason, state; + f.Read7( deltaWakeup, deltaStart, diff, cpu, reason, state, thread ); + refTime += deltaWakeup; + ptr->SetWakeup( refTime ); + refTime += deltaStart; + ptr->SetStartCpu( refTime, cpu ); + if( diff > 0 ) runningTime += diff; + refTime += diff; + ptr->SetEndReasonState( refTime, reason, state ); + ptr->SetThread( CompressThread( thread ) ); + ptr++; } data->runningTime = runningTime; m_data.ctxSwitch.emplace( thread, data ); @@ -1625,14 +1429,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) f.Skip( sizeof( uint64_t ) ); uint64_t csz; f.Read( csz ); - if( fileVer >= FileVersion( 0, 7, 12 ) ) - { - f.Skip( csz * ( sizeof( int64_t ) * 4 + sizeof( int8_t ) * 3 ) ); - } - else - { - f.Skip( csz * ( sizeof( int64_t ) * 3 + sizeof( int8_t ) * 3 ) ); - } + f.Skip( csz * ( sizeof( int64_t ) * 4 + sizeof( int8_t ) * 3 ) ); } } @@ -1697,14 +1494,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) f.Read( sz ); m_data.symbolLoc.reserve_exact( sz, m_slab ); f.Read( sz ); - if( fileVer < FileVersion( 0, 7, 2 ) ) - { - m_data.symbolLocInline.reserve_exact( sz + 1, m_slab ); - } - else - { - m_data.symbolLocInline.reserve_exact( sz, m_slab ); - } + m_data.symbolLocInline.reserve_exact( sz, m_slab ); f.Read( sz ); m_data.symbolMap.reserve( sz ); int symIdx = 0; @@ -1727,10 +1517,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) m_data.symbolLoc[symIdx++] = SymbolLocation { symAddr, size.Val() }; } } - if( fileVer < FileVersion( 0, 7, 2 ) ) - { - m_data.symbolLocInline[symInlineIdx] = std::numeric_limits::max(); - } #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; } ); pdqsort_branchless( m_data.symbolLocInline.begin(), m_data.symbolLocInline.end() ); @@ -1798,31 +1584,28 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) } } - if( fileVer >= FileVersion( 0, 7, 9 ) ) + f.Read( sz ); + m_data.codeSymbolMap.reserve( sz ); + for( uint64_t i=0; isecond; - ReadHwSampleVec( f, data.cycles, m_slab ); - ReadHwSampleVec( f, data.retired, m_slab ); - ReadHwSampleVec( f, data.cacheRef, m_slab ); - ReadHwSampleVec( f, data.cacheMiss, m_slab ); - if( ReadHwSampleVec( f, data.branchRetired, m_slab ) != 0 ) m_data.hasBranchRetirement = true; - ReadHwSampleVec( f, data.branchMiss, m_slab ); - } + f.Read( sz ); + m_data.hwSamples.reserve( sz ); + for( uint64_t i=0; isecond; + ReadHwSampleVec( f, data.cycles, m_slab ); + ReadHwSampleVec( f, data.retired, m_slab ); + ReadHwSampleVec( f, data.cacheRef, m_slab ); + ReadHwSampleVec( f, data.cacheMiss, m_slab ); + if( ReadHwSampleVec( f, data.branchRetired, m_slab ) != 0 ) m_data.hasBranchRetirement = true; + ReadHwSampleVec( f, data.branchMiss, m_slab ); } f.Read( sz ); @@ -1865,14 +1648,6 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) { m_backgroundDone.store( false, std::memory_order_relaxed ); #ifndef TRACY_NO_STATISTICS - if( fileVer < FileVersion( 0, 7, 13 ) ) - { - for( auto& t : m_data.threads ) - { - pdqsort_branchless( t->samples.begin(), t->samples.end(), [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs.time.Val(); } ); - } - } - m_threadBackground = std::thread( [this, eventMask] { std::vector jobs; -- cgit v1.2.3