From 717a21256367ccd099a0b59585a5742c2ef1a705 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 1 Oct 2019 01:05:37 +0200 Subject: [PATCH] Save another 2 bytes per ZoneEvent. ZoneEvent is not 28 bytes. Memory usage reduction on selected traces (sizes in MB): big 9527 -> 9224 (96%) chicken 2107 -> 2044 (97%) drl-l-b 1479 -> 1443 (97%) long 5412 -> 5327 (98%) q3bsp-mt 5592 -> 5400 (96%) selfprofile 1443 -> 1403 (97%) --- server/TracyEvent.hpp | 8 +++- server/TracyView.cpp | 84 ++++++++++++++++----------------- server/TracyWorker.cpp | 103 +++++++++++++++++++++-------------------- server/TracyWorker.hpp | 2 +- 4 files changed, 102 insertions(+), 95 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 9b1c73bd..0876b4ef 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -97,15 +97,19 @@ struct ZoneEvent { int64_t Start() const { return int64_t( _start_srcloc ) >> 16; } void SetStart( int64_t start ) { assert( start < (int64_t)( 1ull << 47 ) ); _start_srcloc = ( _start_srcloc & 0xFFFF ) | ( uint64_t( start ) << 16 ); } + int64_t End() const { return int64_t( _end_child1 ) >> 16; } + void SetEnd( int64_t end ) { assert( end < (int64_t)( 1ull << 47 ) ); _end_child1 = ( _end_child1 & 0xFFFF ) | ( uint64_t( end ) << 16 ); } int16_t SrcLoc() const { return int16_t( _start_srcloc & 0xFFFF ); } void SetSrcLoc( int16_t srcloc ) { _start_srcloc = ( _start_srcloc & 0xFFFFFFFFFFFF0000 ) | uint16_t( srcloc ); } + int32_t Child() const { return int32_t( uint32_t( _end_child1 & 0xFFFF ) | ( uint32_t( _child2 ) << 16 ) ); } + void SetChild( int32_t child ) { _end_child1 = ( _end_child1 & 0xFFFFFFFFFFFF0000 ) | uint16_t( child ); _child2 = uint32_t( child ) >> 16; } uint64_t _start_srcloc; - int64_t end; + uint64_t _end_child1; StringIdx text; uint32_t callstack; StringIdx name; - int32_t child; + uint16_t _child2; }; enum { ZoneEventSize = sizeof( ZoneEvent ) }; diff --git a/server/TracyView.cpp b/server/TracyView.cpp index a23572f5..9e883636 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -2905,12 +2905,12 @@ int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, const auto delay = m_worker.GetDelay(); const auto resolution = m_worker.GetResolution(); // cast to uint64_t, so that unended zones (end = -1) are still drawn - auto it = std::lower_bound( vec.begin(), vec.end(), std::max( 0, m_vd.zvStart - delay ), [] ( const auto& l, const auto& r ) { return (uint64_t)l->end < (uint64_t)r; } ); + auto it = std::lower_bound( vec.begin(), vec.end(), std::max( 0, m_vd.zvStart - delay ), [] ( const auto& l, const auto& r ) { return (uint64_t)l->End() < (uint64_t)r; } ); if( it == vec.end() ) return depth; const auto zitend = std::lower_bound( it, vec.end(), m_vd.zvEnd + resolution, [] ( const auto& l, const auto& r ) { return l->Start() < r; } ); if( it == zitend ) return depth; - if( (*it)->end < 0 && m_worker.GetZoneEnd( **it ) < m_vd.zvStart ) return depth; + if( (*it)->End() < 0 && m_worker.GetZoneEnd( **it ) < m_vd.zvStart ) return depth; const auto w = ImGui::GetWindowContentRegionWidth() - 1; const auto ty = ImGui::GetFontSize(); @@ -2939,7 +2939,7 @@ int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, for(;;) { const auto prevIt = it; - it = std::lower_bound( it, zitend, nextTime, [] ( const auto& l, const auto& r ) { return (uint64_t)l->end < (uint64_t)r; } ); + it = std::lower_bound( it, zitend, nextTime, [] ( const auto& l, const auto& r ) { return (uint64_t)l->End() < (uint64_t)r; } ); if( it == prevIt ) ++it; num += std::distance( prevIt, it ); if( it == zitend ) break; @@ -3007,9 +3007,9 @@ int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, const char* zoneName = m_worker.GetZoneName( ev ); int dmul = ev.text.Active() ? 2 : 1; - if( ev.child >= 0 ) + if( ev.Child() >= 0 ) { - const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.child ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid ); + const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.Child() ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid ); if( d > maxdepth ) maxdepth = d; } @@ -3072,7 +3072,7 @@ int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, DrawTextContrast( draw, wpos + ImVec2( std::max( std::max( 0., px0 ), std::min( double( w - tsz.x ), x ) ), offset ), 0xFFFFFFFF, zoneName ); ImGui::PopClipRect(); } - else if( ev.Start() == ev.end ) + else if( ev.Start() == ev.End() ) { DrawTextContrast( draw, wpos + ImVec2( px0 + ( px1 - px0 - tsz.x ) * 0.5, offset ), 0xFFFFFFFF, zoneName ); } @@ -3124,7 +3124,7 @@ int View::SkipZoneLevel( const Vector& vec, bool hover, double pxns, const auto delay = m_worker.GetDelay(); const auto resolution = m_worker.GetResolution(); // cast to uint64_t, so that unended zones (end = -1) are still drawn - auto it = std::lower_bound( vec.begin(), vec.end(), std::max( 0, m_vd.zvStart - delay ), [] ( const auto& l, const auto& r ) { return (uint64_t)l->end < (uint64_t)r; } ); + auto it = std::lower_bound( vec.begin(), vec.end(), std::max( 0, m_vd.zvStart - delay ), [] ( const auto& l, const auto& r ) { return (uint64_t)l->End() < (uint64_t)r; } ); if( it == vec.end() ) return depth; const auto zitend = std::lower_bound( it, vec.end(), m_vd.zvEnd + resolution, [] ( const auto& l, const auto& r ) { return l->Start() < r; } ); @@ -3145,7 +3145,7 @@ int View::SkipZoneLevel( const Vector& vec, bool hover, double pxns, for(;;) { const auto prevIt = it; - it = std::lower_bound( it, zitend, nextTime, [] ( const auto& l, const auto& r ) { return (uint64_t)l->end < (uint64_t)r; } ); + it = std::lower_bound( it, zitend, nextTime, [] ( const auto& l, const auto& r ) { return (uint64_t)l->End() < (uint64_t)r; } ); if( it == prevIt ) ++it; if( it == zitend ) break; const auto nend = m_worker.GetZoneEnd( **it ); @@ -3157,9 +3157,9 @@ int View::SkipZoneLevel( const Vector& vec, bool hover, double pxns, } else { - if( ev.child >= 0 ) + if( ev.Child() >= 0 ) { - const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.child ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid ); + const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.Child() ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid ); if( d > maxdepth ) maxdepth = d; } ++it; @@ -5824,9 +5824,9 @@ void View::DrawZoneInfoWindow() } } ); - if( ev.child >= 0 ) + if( ev.Child() >= 0 ) { - const auto& children = m_worker.GetZoneChildren( ev.child ); + const auto& children = m_worker.GetZoneChildren( ev.Child() ); bool expand = ImGui::TreeNode( "Child zones" ); ImGui::SameLine(); ImGui::TextDisabled( "(%s)", RealToString( children.size(), true ) ); @@ -7418,7 +7418,7 @@ void View::DrawFindZone() for( i=m_findZone.sortedNum; iend - ev.Zone()->Start() - GetZoneChildTimeFast( *ev.Zone() ); + const auto t = ev.Zone()->End() - ev.Zone()->Start() - GetZoneChildTimeFast( *ev.Zone() ); vec.emplace_back( t ); act++; total += t; @@ -7518,7 +7518,7 @@ void View::DrawFindZone() auto& ev = zones[i]; if( selGroup == GetSelectionTarget( ev, groupBy ) ) { - const auto t = ev.Zone()->end - ev.Zone()->Start(); + const auto t = ev.Zone()->End() - ev.Zone()->Start(); vec.emplace_back( t ); act++; total += t; @@ -8245,7 +8245,7 @@ void View::DrawFindZone() while( processed < sz ) { auto& ev = zones[processed]; - if( ev.Zone()->end < 0 ) break; + if( ev.Zone()->End() < 0 ) break; const auto end = m_worker.GetZoneEndDirect( *ev.Zone() ); auto timespan = end - ev.Zone()->Start(); @@ -9051,8 +9051,8 @@ void View::DrawCompare() for( i=m_compare.sortedNum[k]; ibegin(), timeline->end(), zone.Start(), [] ( const auto& l, const auto& r ) { return l < r->Start(); } ); if( it != timeline->begin() ) --it; - assert( !( zone.end >= 0 && (*it)->Start() > zone.end ) ); + assert( !( zone.End() >= 0 && (*it)->Start() > zone.End() ) ); if( *it == &zone ) return depth; - assert( (*it)->child >= 0 ); - timeline = &m_worker.GetZoneChildren( (*it)->child ); + assert( (*it)->Child() >= 0 ); + timeline = &m_worker.GetZoneChildren( (*it)->Child() ); depth++; } } @@ -12774,11 +12774,11 @@ const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const { auto it = std::upper_bound( timeline->begin(), timeline->end(), zone.Start(), [] ( const auto& l, const auto& r ) { return l < r->Start(); } ); if( it != timeline->begin() ) --it; - if( zone.end >= 0 && (*it)->Start() > zone.end ) break; + if( zone.End() >= 0 && (*it)->Start() > zone.End() ) break; if( *it == &zone ) return parent; - if( (*it)->child < 0 ) break; + if( (*it)->Child() < 0 ) break; parent = *it; - timeline = &m_worker.GetZoneChildren( parent->child ); + timeline = &m_worker.GetZoneChildren( parent->Child() ); } } return nullptr; @@ -12818,10 +12818,10 @@ const ThreadData* View::GetZoneThreadData( const ZoneEvent& zone ) const { auto it = std::upper_bound( timeline->begin(), timeline->end(), zone.Start(), [] ( const auto& l, const auto& r ) { return l < r->Start(); } ); if( it != timeline->begin() ) --it; - if( zone.end >= 0 && (*it)->Start() > zone.end ) break; + if( zone.End() >= 0 && (*it)->Start() > zone.End() ) break; if( *it == &zone ) return thread; - if( (*it)->child < 0 ) break; - timeline = &m_worker.GetZoneChildren( (*it)->child ); + if( (*it)->Child() < 0 ) break; + timeline = &m_worker.GetZoneChildren( (*it)->Child() ); } } return nullptr; @@ -12903,10 +12903,10 @@ const ZoneEvent* View::FindZoneAtTime( uint64_t thread, int64_t time ) const { auto it = std::upper_bound( timeline->begin(), timeline->end(), time, [] ( const auto& l, const auto& r ) { return l < r->Start(); } ); if( it != timeline->begin() ) --it; - if( (*it)->Start() > time || ( (*it)->end >= 0 && (*it)->end < time ) ) return ret; + if( (*it)->Start() > time || ( (*it)->End() >= 0 && (*it)->End() < time ) ) return ret; ret = *it; - if( (*it)->child < 0 ) return ret; - timeline = &m_worker.GetZoneChildren( (*it)->child ); + if( (*it)->Child() < 0 ) return ret; + timeline = &m_worker.GetZoneChildren( (*it)->Child() ); } } @@ -13009,11 +13009,11 @@ void View::SetViewToLastFrames() int64_t View::GetZoneChildTime( const ZoneEvent& zone ) { int64_t time = 0; - if( zone.child >= 0 ) + if( zone.Child() >= 0 ) { - for( auto& v : m_worker.GetZoneChildren( zone.child ) ) + for( auto& v : m_worker.GetZoneChildren( zone.Child() ) ) { - const auto childSpan = std::max( int64_t( 0 ), v->end - v->Start() ); + const auto childSpan = std::max( int64_t( 0 ), v->End() - v->Start() ); time += childSpan; } } @@ -13037,12 +13037,12 @@ int64_t View::GetZoneChildTime( const GpuEvent& zone ) int64_t View::GetZoneChildTimeFast( const ZoneEvent& zone ) { int64_t time = 0; - if( zone.child >= 0 ) + if( zone.Child() >= 0 ) { - for( auto& v : m_worker.GetZoneChildren( zone.child ) ) + for( auto& v : m_worker.GetZoneChildren( zone.Child() ) ) { - assert( v->end >= 0 ); - time += v->end - v->Start(); + assert( v->End() >= 0 ); + time += v->End() - v->Start(); } } return time; @@ -13054,7 +13054,7 @@ int64_t View::GetZoneSelfTime( const ZoneEvent& zone ) if( m_cache.zoneSelfTime2.first == &zone ) return m_cache.zoneSelfTime2.second; const auto ztime = m_worker.GetZoneEnd( zone ) - zone.Start(); const auto selftime = ztime - GetZoneChildTime( zone ); - if( zone.end >= 0 ) + if( zone.End() >= 0 ) { m_cache.zoneSelfTime2 = m_cache.zoneSelfTime; m_cache.zoneSelfTime = std::make_pair( &zone, selftime ); diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 40b87ad8..92ada8b1 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -1649,9 +1649,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) for( auto& zone : vec ) { ReadTimelineUpdateStatistics( zone, thread ); - if( zone->child >= 0 ) + if( zone->Child() >= 0 ) { - ProcessTimeline( GetZoneChildren( zone->child ), thread ); + ProcessTimeline( GetZoneChildren( zone->Child() ), thread ); } } }; @@ -1925,9 +1925,9 @@ int64_t Worker::GetZoneEnd( const ZoneEvent& ev ) auto ptr = &ev; for(;;) { - if( ptr->end >= 0 ) return ptr->end; - if( ptr->child < 0 ) return ptr->Start(); - ptr = GetZoneChildren( ptr->child ).back(); + if( ptr->End() >= 0 ) return ptr->End(); + if( ptr->Child() < 0 ) return ptr->Start(); + ptr = GetZoneChildren( ptr->Child() ).back(); } } @@ -2611,9 +2611,9 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread ) else { auto back = td->stack.back(); - if( back->child < 0 ) + if( back->Child() < 0 ) { - back->child = int32_t( m_data.zoneChildren.size() ); + back->SetChild( int32_t( m_data.zoneChildren.size() ) ); if( m_data.zoneVectorCache.empty() ) { m_data.zoneChildren.push_back( Vector( zone ) ); @@ -2629,7 +2629,7 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread ) } else { - m_data.zoneChildren[back->child].push_back( zone ); + m_data.zoneChildren[back->Child()].push_back( zone ); } td->stack.push_back_non_empty( zone ); } @@ -3260,10 +3260,10 @@ void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev ) const auto start = TscTime( ev.time - m_data.baseTime ); zone->SetStart( start ); - zone->end = -1; + zone->SetEnd( -1 ); zone->SetSrcLoc( ShrinkSourceLocation( ev.srcloc ) ); zone->callstack = 0; - zone->child = -1; + zone->SetChild( -1 ); m_data.lastTime = std::max( m_data.lastTime, start ); @@ -3293,10 +3293,10 @@ void Worker::ProcessZoneBeginAllocSrcLocImpl( ZoneEvent* zone, const QueueZoneBe const auto start = TscTime( ev.time - m_data.baseTime ); zone->SetStart( start ); - zone->end = -1; + zone->SetEnd( -1 ); zone->SetSrcLoc( it->second ); zone->callstack = 0; - zone->child = -1; + zone->SetChild( -1 ); m_data.lastTime = std::max( m_data.lastTime, start ); @@ -3342,15 +3342,15 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev ) auto& stack = td->stack; assert( !stack.empty() ); auto zone = stack.back_and_pop(); - assert( zone->end == -1 ); - zone->end = TscTime( ev.time - m_data.baseTime ); - assert( zone->end >= zone->Start() ); + assert( zone->End() == -1 ); + zone->SetEnd( TscTime( ev.time - m_data.baseTime ) ); + assert( zone->End() >= zone->Start() ); - m_data.lastTime = std::max( m_data.lastTime, zone->end ); + m_data.lastTime = std::max( m_data.lastTime, zone->End() ); - if( zone->child >= 0 ) + if( zone->Child() >= 0 ) { - auto& childVec = m_data.zoneChildren[zone->child]; + auto& childVec = m_data.zoneChildren[zone->Child()]; const auto sz = childVec.size(); if( sz <= 8 * 1024 ) { @@ -3363,7 +3363,7 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev ) } #ifndef TRACY_NO_STATISTICS - auto timeSpan = zone->end - zone->Start(); + auto timeSpan = zone->End() - zone->Start(); if( timeSpan > 0 ) { auto it = m_data.sourceLocationZones.find( zone->SrcLoc() ); @@ -3373,11 +3373,11 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev ) slz.max = std::max( slz.max, timeSpan ); slz.total += timeSpan; slz.sumSq += double( timeSpan ) * timeSpan; - if( zone->child >= 0 ) + if( zone->Child() >= 0 ) { - for( auto& v : GetZoneChildren( zone->child ) ) + for( auto& v : GetZoneChildren( zone->Child() ) ) { - const auto childSpan = std::max( int64_t( 0 ), v->end - v->Start() ); + const auto childSpan = std::max( int64_t( 0 ), v->End() - v->Start() ); timeSpan -= childSpan; } } @@ -4550,18 +4550,18 @@ void Worker::ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_ f.Read( sz ); if( sz == 0 ) { - zone->child = -1; + zone->SetChild( -1 ); } else { - zone->child = m_data.zoneChildren.size(); + zone->SetChild( m_data.zoneChildren.size() ); // Put placeholder to have proper size of zone children in nested calls m_data.zoneChildren.push_back( Vector() ); // Real data buffer. Can't use placeholder, as the vector can be reallocated // and the buffer address will change, but the reference won't. Vector tmp; ReadTimeline( f, tmp, thread, sz, refTime ); - m_data.zoneChildren[zone->child] = std::move( tmp ); + m_data.zoneChildren[zone->Child()] = std::move( tmp ); } } @@ -4571,15 +4571,15 @@ void Worker::ReadTimelinePre042( FileRead& f, ZoneEvent* zone, uint16_t thread, f.Read( sz ); if( sz == 0 ) { - zone->child = -1; + zone->SetChild( -1 ); } else { - zone->child = m_data.zoneChildren.size(); + zone->SetChild( m_data.zoneChildren.size() ); m_data.zoneChildren.push_back( Vector() ); Vector tmp; ReadTimelinePre042( f, tmp, thread, sz, fileVer ); - m_data.zoneChildren[zone->child] = std::move( tmp ); + m_data.zoneChildren[zone->Child()] = std::move( tmp ); } } @@ -4589,15 +4589,15 @@ void Worker::ReadTimelinePre058( FileRead& f, ZoneEvent* zone, uint16_t thread, f.Read( sz ); if( sz == 0 ) { - zone->child = -1; + zone->SetChild( -1 ); } else { - zone->child = m_data.zoneChildren.size(); + zone->SetChild( m_data.zoneChildren.size() ); m_data.zoneChildren.push_back( Vector() ); Vector tmp; ReadTimelinePre058( f, tmp, thread, sz, refTime, fileVer ); - m_data.zoneChildren[zone->child] = std::move( tmp ); + m_data.zoneChildren[zone->Child()] = std::move( tmp ); } } @@ -4647,20 +4647,20 @@ void Worker::ReadTimelineUpdateStatistics( ZoneEvent* zone, uint16_t thread ) ztd.SetZone( zone ); ztd.SetThread( thread ); - if( zone->end >= 0 ) + if( zone->End() >= 0 ) { - auto timeSpan = zone->end - zone->Start(); + auto timeSpan = zone->End() - zone->Start(); if( timeSpan > 0 ) { slz.min = std::min( slz.min, timeSpan ); slz.max = std::max( slz.max, timeSpan ); slz.total += timeSpan; slz.sumSq += double( timeSpan ) * timeSpan; - if( zone->child >= 0 ) + if( zone->Child() >= 0 ) { - for( auto& v : GetZoneChildren( zone->child ) ) + for( auto& v : GetZoneChildren( zone->Child() ) ) { - const auto childSpan = std::max( int64_t( 0 ), v->end - v->Start() ); + const auto childSpan = std::max( int64_t( 0 ), v->End() - v->Start() ); timeSpan -= childSpan; } } @@ -4694,12 +4694,12 @@ void Worker::ReadTimeline( FileRead& f, Vector& vec, uint16_t thread int16_t srcloc; f.Read( srcloc ); zone->SetSrcLoc( srcloc ); - // Use zone->end as scratch buffer for zone start time offset. - f.Read( &zone->end, sizeof( zone->end ) + sizeof( zone->text ) + sizeof( zone->callstack ) + sizeof( zone->name ) ); - refTime += zone->end; + // Use zone->_end_child1 as scratch buffer for zone start time offset. + f.Read( &zone->_end_child1, sizeof( zone->_end_child1 ) + sizeof( zone->text ) + sizeof( zone->callstack ) + sizeof( zone->name ) ); + refTime += int64_t( zone->_end_child1 ); zone->SetStart( refTime ); ReadTimeline( f, zone, thread, refTime ); - zone->end = ReadTimeOffset( f, refTime ); + zone->SetEnd( ReadTimeOffset( f, refTime ) ); #ifdef TRACY_NO_STATISTICS ReadTimelineUpdateStatistics( zone, thread ); #endif @@ -4722,8 +4722,10 @@ void Worker::ReadTimelinePre042( FileRead& f, Vector& vec, uint16_t int64_t start; f.Read( start ); zone->SetStart( start - m_data.baseTime ); - f.Read( zone->end ); - if( zone->end >= 0 ) zone->end -= 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 ); @@ -4776,11 +4778,11 @@ void Worker::ReadTimelinePre058( FileRead& f, Vector& vec, uint16_t int16_t srcloc; f.Read( srcloc ); zone->SetSrcLoc( srcloc ); - f.Read( &zone->end, sizeof( zone->end ) ); + f.Read( &zone->_end_child1, sizeof( zone->_end_child1 ) ); } else { - f.Read( &zone->end, sizeof( zone->end ) ); + f.Read( &zone->_end_child1, sizeof( zone->_end_child1 ) ); int16_t srcloc; f.Read( srcloc ); zone->SetSrcLoc( srcloc ); @@ -4813,11 +4815,12 @@ void Worker::ReadTimelinePre058( FileRead& f, Vector& vec, uint16_t { new ( &zone->name ) StringIdx(); } - refTime += zone->end; + refTime += zone->_end_child1; zone->SetStart( refTime - m_data.baseTime ); ReadTimelinePre058( f, zone, thread, refTime, fileVer ); - zone->end = ReadTimeOffset( f, refTime ); - if( zone->end >= 0 ) zone->end -= m_data.baseTime; + int64_t end = ReadTimeOffset( f, refTime ); + if( end >= 0 ) end -= m_data.baseTime; + zone->SetEnd( end ); #ifdef TRACY_NO_STATISTICS ReadTimelineUpdateStatistics( zone, thread ); #endif @@ -5335,17 +5338,17 @@ void Worker::WriteTimeline( FileWrite& f, const Vector& vec, int64_t f.Write( &v->callstack, sizeof( v->callstack ) ); f.Write( &v->name, sizeof( v->name ) ); - if( v->child < 0 ) + if( v->Child() < 0 ) { sz = 0; f.Write( &sz, sizeof( sz ) ); } else { - WriteTimeline( f, GetZoneChildren( v->child ), refTime ); + WriteTimeline( f, GetZoneChildren( v->Child() ), refTime ); } - WriteTimeOffset( f, refTime, v->end ); + WriteTimeOffset( f, refTime, v->End() ); } } diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index c8129d62..f9ddeb09 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -338,7 +338,7 @@ public: // GetZoneEndDirect() will only return zone's direct timing data, without looking at children. int64_t GetZoneEnd( const ZoneEvent& ev ); int64_t GetZoneEnd( const GpuEvent& ev ); - static tracy_force_inline int64_t GetZoneEndDirect( const ZoneEvent& ev ) { return ev.end >= 0 ? ev.end : ev.Start(); } + static tracy_force_inline int64_t GetZoneEndDirect( const ZoneEvent& ev ) { return ev.End() >= 0 ? ev.End() : ev.Start(); } static tracy_force_inline int64_t GetZoneEndDirect( const GpuEvent& ev ) { return ev.gpuEnd >= 0 ? ev.gpuEnd : ev.gpuStart; } const char* GetString( uint64_t ptr ) const;