diff --git a/server/TracyView.hpp b/server/TracyView.hpp index c16ba460..9050f618 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -291,6 +291,7 @@ private: const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const; const ZoneEvent* GetZoneParent( const ZoneEvent& zone, uint64_t tid ) const; + const ZoneEvent* GetZoneChild( const ZoneEvent& zone, int64_t time ) const; bool IsZoneReentry( const ZoneEvent& zone ) const; bool IsZoneReentry( const ZoneEvent& zone, uint64_t tid ) const; const GpuEvent* GetZoneParent( const GpuEvent& zone ) const; diff --git a/server/TracyView_Utility.cpp b/server/TracyView_Utility.cpp index d30e55e8..ff094120 100644 --- a/server/TracyView_Utility.cpp +++ b/server/TracyView_Utility.cpp @@ -194,6 +194,27 @@ const ZoneEvent* View::FindZoneAtTime( uint64_t thread, int64_t time ) const } } +const ZoneEvent* View::GetZoneChild( const ZoneEvent& zone, int64_t time ) const +{ + if( !zone.HasChildren() ) return nullptr; + auto& children = m_worker.GetZoneChildren( zone.Child() ); + if( children.is_magic() ) + { + auto& vec = *((Vector*)&children); + auto it = std::upper_bound( vec.begin(), vec.end(), time, [] ( const auto& l, const auto& r ) { return l < r.Start(); } ); + if( it != vec.begin() ) --it; + if( it->Start() > time || ( it->IsEndValid() && it->End() < time ) ) return nullptr; + return it; + } + else + { + auto it = std::upper_bound( children.begin(), children.end(), time, [] ( const auto& l, const auto& r ) { return l < r->Start(); } ); + if( it != children.begin() ) --it; + if( (*it)->Start() > time || ( (*it)->IsEndValid() && (*it)->End() < time ) ) return nullptr; + return *it; + } +} + const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const { #ifndef TRACY_NO_STATISTICS diff --git a/server/TracyView_ZoneInfo.cpp b/server/TracyView_ZoneInfo.cpp index 21cefa2d..ec3e32a7 100644 --- a/server/TracyView_ZoneInfo.cpp +++ b/server/TracyView_ZoneInfo.cpp @@ -881,11 +881,7 @@ void View::DrawZoneInfoWindow() ImGui::TableHeadersRow(); do { - if( m_messagesExcludeChildren ) - { - auto msgzone = FindZoneAtTime( tid, (*msgit)->time ); - if( msgzone != &ev ) continue; - } + if( m_messagesExcludeChildren && GetZoneChild( ev, (*msgit)->time ) ) continue; ImGui::PushID( *msgit ); ImGui::TableNextRow(); ImGui::TableNextColumn();