diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index e96e814d..278c8b13 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -2313,12 +2313,12 @@ const uint64_t* Worker::GetInlineSymbolList( uint64_t sym, uint32_t len ) return it; } -int64_t Worker::GetZoneEnd( const ZoneEvent& ev ) +int64_t Worker::GetZoneEndImpl( const ZoneEvent& ev ) { + assert( !ev.IsEndValid() ); auto ptr = &ev; for(;;) { - if( ptr->IsEndValid() ) return ptr->End(); if( !ptr->HasChildren() ) return ptr->Start(); auto& children = GetZoneChildren( ptr->Child() ); if( children.is_magic() ) @@ -2330,15 +2330,16 @@ int64_t Worker::GetZoneEnd( const ZoneEvent& ev ) { ptr = children.back(); } + if( ptr->IsEndValid() ) return ptr->End(); } } -int64_t Worker::GetZoneEnd( const GpuEvent& ev ) +int64_t Worker::GetZoneEndImpl( const GpuEvent& ev ) { + assert( ev.GpuEnd() < 0 ); auto ptr = &ev; for(;;) { - if( ptr->GpuEnd() >= 0 ) return ptr->GpuEnd(); if( ptr->Child() < 0 ) return ptr->GpuStart() >= 0 ? ptr->GpuStart() : m_data.lastTime; auto& children = GetGpuChildren( ptr->Child() ); if( children.is_magic() ) @@ -2350,6 +2351,7 @@ int64_t Worker::GetZoneEnd( const GpuEvent& ev ) { ptr = children.back(); } + if( ptr->GpuEnd() >= 0 ) return ptr->GpuEnd(); } } diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 6c9a1a6a..e3b3deaf 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -562,8 +562,8 @@ public: // GetZoneEnd() will try to infer the end time by looking at child zones (parent zone can't end // before its children have ended). // 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 ); + tracy_force_inline int64_t GetZoneEnd( const ZoneEvent& ev ) { return ev.IsEndValid() ? ev.End() : GetZoneEndImpl( ev ); } + tracy_force_inline int64_t GetZoneEnd( const GpuEvent& ev ) { return ev.GpuEnd() >= 0 ? ev.GpuEnd() : GetZoneEndImpl( ev ); } static tracy_force_inline int64_t GetZoneEndDirect( const ZoneEvent& ev ) { return ev.IsEndValid() ? ev.End() : ev.Start(); } static tracy_force_inline int64_t GetZoneEndDirect( const GpuEvent& ev ) { return ev.GpuEnd() >= 0 ? ev.GpuEnd() : ev.GpuStart(); } @@ -929,6 +929,9 @@ private: tracy_force_inline ZoneExtra& AllocZoneExtra( ZoneEvent& ev ); tracy_force_inline ZoneExtra& RequestZoneExtra( ZoneEvent& ev ); + int64_t GetZoneEndImpl( const ZoneEvent& ev ); + int64_t GetZoneEndImpl( const GpuEvent& ev ); + void UpdateMbps( int64_t td ); int64_t ReadTimeline( FileRead& f, Vector>& vec, uint32_t size, int64_t refTime, int32_t& childIdx );