diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 17299cdf..42f87932 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -261,20 +261,15 @@ enum { ContextSwitchDataSize = sizeof( ContextSwitchData ) }; // might come after context switch data). struct ContextSwitchCpu { - int64_t Start() const { return int64_t( _start_thread1 ) >> 16; } - void SetStart( int64_t start ) { assert( start < ( 1ll << 47 ) ); _start_thread1 = ( _start_thread1 & 0xFFFF ) | uint64_t( start << 16 ); } - int64_t End() const { return int64_t( _end_thread2 ) >> 16; } - void SetEnd( int64_t end ) { assert( end < ( 1ll << 47 ) ); _end_thread2 = ( _end_thread2 & 0xFFFF ) | uint64_t( end << 16 ); } - uint64_t Thread() const { return uint64_t( uint16_t( _start_thread1 ) ) | ( uint64_t( uint16_t( _end_thread2 ) ) << 16 ) | ( uint64_t( _thread3 ) << 32 ); } - void SetThread( uint64_t thread ) { - _start_thread1 = ( _start_thread1 & 0xFFFFFFFFFFFF0000 ) | uint16_t( thread ); - _end_thread2 = ( _end_thread2 & 0xFFFFFFFFFFFF0000 ) | uint16_t( thread >> 16 ); - _thread3 = uint32_t( thread >> 32 ); - } + int64_t Start() const { return int64_t( _start_thread ) >> 16; } + void SetStart( int64_t start ) { assert( start < ( 1ll << 47 ) ); _start_thread = ( _start_thread & 0xFFFF ) | uint64_t( start << 16 ); } + int64_t End() const { return _end; } + void SetEnd( int64_t end ) { assert( end < ( 1ll << 47 ) ); _end = end; } + uint16_t Thread() const { return uint16_t( _start_thread ); } + void SetThread( uint16_t thread ) { _start_thread = ( _start_thread & 0xFFFFFFFFFFFF0000 ) | thread; } - uint64_t _start_thread1; - uint64_t _end_thread2; - uint32_t _thread3; + uint64_t _start_thread; + uint64_t _end; }; enum { ContextSwitchCpuSize = sizeof( ContextSwitchCpu ) }; diff --git a/server/TracyVersion.hpp b/server/TracyVersion.hpp index 7aeb790e..e736fd40 100644 --- a/server/TracyVersion.hpp +++ b/server/TracyVersion.hpp @@ -7,7 +7,7 @@ namespace Version { enum { Major = 0 }; enum { Minor = 5 }; -enum { Patch = 5 }; +enum { Patch = 6 }; } } diff --git a/server/TracyView.cpp b/server/TracyView.cpp index c7cd2ed1..8c901bc4 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3991,7 +3991,7 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, } else { - const auto thread = it->Thread(); + const auto thread = m_worker.DecompressThreadExternal( it->Thread() ); const auto local = m_worker.IsThreadLocal( thread ); auto txt = local ? m_worker.GetThreadString( thread ) : m_worker.GetExternalName( thread ).first; bool untracked = false; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 89166fe2..3aa9059b 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -516,6 +516,10 @@ Worker::Worker( FileRead& f, EventType::Type eventMask ) } 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= FileVersion( 0, 5, 1 ) ) + 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 ); @@ -1399,21 +1403,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask ) data->v.reserve_exact( csz, m_slab ); int64_t runningTime = 0; int64_t refTime = 0; - if( fileVer <= FileVersion( 0, 5, 2 ) ) refTime = -m_data.baseTime; auto ptr = data->v.data(); for( uint64_t j=0; j= FileVersion( 0, 5, 4 ) ) - { - ptr->wakeup = ReadTimeOffset( f, refTime ); - ptr->SetStart( ReadTimeOffset( f, refTime ) ); - } - else - { - int64_t start = ReadTimeOffset( f, refTime ); - ptr->wakeup = start; - ptr->SetStart( start ); - } + ptr->wakeup = ReadTimeOffset( f, refTime ); + ptr->SetStart( ReadTimeOffset( f, refTime ) ); int64_t diff; f.Read( diff ); if( diff > 0 ) runningTime += diff; @@ -1447,10 +1441,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask ) f.Skip( csz * sizeof( ContextSwitchData ) ); } } - } - if( fileVer >= FileVersion( 0, 5, 3 ) ) - { s_loadProgress.subTotal.store( 0, std::memory_order_relaxed ); s_loadProgress.progress.store( LoadProgress::ContextSwitchesPerCpu, std::memory_order_relaxed ); f.Read( sz ); @@ -1468,7 +1459,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask ) { ptr->SetStart( ReadTimeOffset( f, refTime ) ); ptr->SetEnd( ReadTimeOffset( f, refTime ) ); - uint64_t thread; + uint16_t thread; f.Read( thread ); ptr->SetThread( thread ); ptr++; @@ -1485,10 +1476,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask ) f.Skip( sizeof( uint64_t ) * 3 * sz ); } } - } - if( fileVer >= FileVersion( 0, 5, 5 ) ) - { f.Read( sz ); for( uint64_t i=0; i> lockMap; ThreadCompress localThreadCompress; + ThreadCompress externalThreadCompress; std::pair threadDataLast; Vector> zoneChildren; @@ -359,6 +360,7 @@ public: tracy_force_inline uint16_t CompressThread( uint64_t thread ) { return m_data.localThreadCompress.CompressThread( thread ); } tracy_force_inline uint64_t DecompressThread( uint16_t thread ) const { return m_data.localThreadCompress.DecompressThread( thread ); } + tracy_force_inline uint64_t DecompressThreadExternal( uint16_t thread ) const { return m_data.externalThreadCompress.DecompressThread( thread ); } std::shared_mutex& GetMbpsDataLock() { return m_mbpsData.lock; } const std::vector& GetMbpsData() const { return m_mbpsData.mbps; }