Don't match source location on a per-zone basis.

This commit is contained in:
Bartosz Taudul 2018-03-04 16:53:13 +01:00
parent b48602f5d1
commit 80da271a2c
2 changed files with 8 additions and 8 deletions

View File

@ -3226,10 +3226,13 @@ const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
void View::FindZones() void View::FindZones()
{ {
const auto match = m_worker.GetMatchingSourceLocation( m_findZone.pattern );
if( match.empty() ) return;
for( const auto& v : m_worker.GetThreadData() ) for( const auto& v : m_worker.GetThreadData() )
{ {
auto thrOut = std::make_unique<ThreadData>(); auto thrOut = std::make_unique<ThreadData>();
FindZones( v->timeline, thrOut->timeline, m_findZone.maxDepth ); FindZones( v->timeline, thrOut->timeline, match, m_findZone.maxDepth );
if( !thrOut->timeline.empty() ) if( !thrOut->timeline.empty() )
{ {
@ -3239,24 +3242,21 @@ void View::FindZones()
} }
} }
void View::FindZones( const Vector<ZoneEvent*>& events, Vector<ZoneEvent*>& out, const int maxdepth ) void View::FindZones( const Vector<ZoneEvent*>& events, Vector<ZoneEvent*>& out, const std::vector<int32_t>& match, const int maxdepth )
{ {
for( auto& ev : events ) for( auto& ev : events )
{ {
if( out.size() >= m_findZone.maxZonesPerThread ) break; if( out.size() >= m_findZone.maxZonesPerThread ) break;
if( m_worker.GetZoneEnd( *ev ) == ev->start ) continue; if( m_worker.GetZoneEnd( *ev ) == ev->start ) continue;
const auto& srcloc = m_worker.GetSourceLocation( ev->srcloc ); if( std::find( match.begin(), match.end(), ev->srcloc ) != match.end() )
const auto str = m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function );
if( strstr( str, m_findZone.pattern ) != nullptr )
{ {
out.push_back( ev ); out.push_back( ev );
} }
if( maxdepth != 0 ) if( maxdepth != 0 )
{ {
FindZones( ev->child, out, maxdepth - 1 ); FindZones( ev->child, out, match, maxdepth - 1 );
} }
} }
} }

View File

@ -91,7 +91,7 @@ private:
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const; const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
void FindZones(); void FindZones();
void FindZones( const Vector<ZoneEvent*> &events, Vector<ZoneEvent*> &out, const int maxdepth = 0 ); void FindZones( const Vector<ZoneEvent*> &events, Vector<ZoneEvent*> &out, const std::vector<int32_t>& match, const int maxdepth = 0 );
template <typename T> template <typename T>
bool& Visible( const T* ptr ) bool& Visible( const T* ptr )