From 2c508c1f79f50451f1ef5beb06a9bbaf92214342 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 4 Mar 2018 21:10:10 +0100 Subject: [PATCH] Display list of matched source locations in search window. --- server/TracyView.cpp | 38 ++++++++++++++++++++++++++++++++------ server/TracyView.hpp | 4 +++- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 4de9fcf4..46ddb95d 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -2673,6 +2673,8 @@ void View::DrawFindZone() if( ImGui::Button( "Clear" ) ) { m_findZone.result.clear(); + m_findZone.match.clear(); + m_findZone.matchEnable.clear(); } if( ImGui::TreeNode( "Options" ) ) @@ -2689,9 +2691,31 @@ void View::DrawFindZone() if( findClicked ) { m_findZone.result.clear(); + m_findZone.match.clear(); + m_findZone.matchEnable.clear(); FindZones(); } + if( !m_findZone.match.empty() ) + { + ImGui::Separator(); + if( ImGui::TreeNode( "Matched source locations" ) ) + { + for( size_t i=0; i( m_findZone.match.size(), true ); for( const auto& v : m_worker.GetThreadData() ) { auto thrOut = std::make_unique(); - FindZones( v->timeline, thrOut->timeline, match, m_findZone.maxDepth ); + FindZones( v->timeline, thrOut->timeline, m_findZone.maxDepth ); if( !thrOut->timeline.empty() ) { @@ -3253,21 +3279,21 @@ void View::FindZones() } } -void View::FindZones( const Vector& events, Vector& out, const std::vector& match, const int maxdepth ) +void View::FindZones( const Vector& events, Vector& out, const int maxdepth ) { for( auto& ev : events ) { if( out.size() >= m_findZone.maxZonesPerThread ) break; if( m_worker.GetZoneEnd( *ev ) == ev->start ) continue; - if( std::find( match.begin(), match.end(), ev->srcloc ) != match.end() ) + if( std::find( m_findZone.match.begin(), m_findZone.match.end(), ev->srcloc ) != m_findZone.match.end() ) { out.push_back( ev ); } if( maxdepth != 0 ) { - FindZones( ev->child, out, match, maxdepth - 1 ); + FindZones( ev->child, out, maxdepth - 1 ); } } } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 188ed450..b2e2cc91 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 std::vector& match, const int maxdepth = 0 ); + void FindZones( const Vector &events, Vector &out, const int maxdepth = 0 ); template bool& Visible( const T* ptr ) @@ -163,6 +163,8 @@ private: struct { bool show; std::vector> result; + std::vector match; + std::vector matchEnable; char pattern[1024] = { "" }; int maxZonesPerThread = -1; int maxDepth = -1;