From 80da271a2c93cc321375dc6943248bee02da13a7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 4 Mar 2018 16:53:13 +0100 Subject: [PATCH] Don't match source location on a per-zone basis. --- server/TracyView.cpp | 14 +++++++------- server/TracyView.hpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index ffb0fe44..e3b7bb6f 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3226,10 +3226,13 @@ const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const void View::FindZones() { + const auto match = m_worker.GetMatchingSourceLocation( m_findZone.pattern ); + if( match.empty() ) return; + for( const auto& v : m_worker.GetThreadData() ) { auto thrOut = std::make_unique(); - FindZones( v->timeline, thrOut->timeline, m_findZone.maxDepth ); + FindZones( v->timeline, thrOut->timeline, match, m_findZone.maxDepth ); if( !thrOut->timeline.empty() ) { @@ -3239,24 +3242,21 @@ void View::FindZones() } } -void View::FindZones( const Vector& events, Vector& out, const int maxdepth ) +void View::FindZones( const Vector& events, Vector& out, const std::vector& match, const int maxdepth ) { for( auto& ev : events ) { if( out.size() >= m_findZone.maxZonesPerThread ) break; if( m_worker.GetZoneEnd( *ev ) == ev->start ) continue; - const auto& srcloc = m_worker.GetSourceLocation( ev->srcloc ); - const auto str = m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ); - - if( strstr( str, m_findZone.pattern ) != nullptr ) + if( std::find( match.begin(), match.end(), ev->srcloc ) != match.end() ) { out.push_back( ev ); } if( maxdepth != 0 ) { - FindZones( ev->child, out, maxdepth - 1 ); + FindZones( ev->child, out, match, maxdepth - 1 ); } } } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index c58369e8..188ed450 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -91,7 +91,7 @@ private: const GpuEvent* GetZoneParent( const GpuEvent& zone ) const; void FindZones(); - void FindZones( const Vector &events, Vector &out, const int maxdepth = 0 ); + void FindZones( const Vector &events, Vector &out, const std::vector& match, const int maxdepth = 0 ); template bool& Visible( const T* ptr )