1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Fast search for zone tid in GetZoneThreadData().

This commit is contained in:
Bartosz Taudul 2021-02-07 20:26:58 +01:00
parent c6c9fec383
commit 9b5cc3352a

View File

@ -17312,6 +17312,21 @@ const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
const ThreadData* View::GetZoneThreadData( const ZoneEvent& zone ) const const ThreadData* View::GetZoneThreadData( const ZoneEvent& zone ) const
{ {
#ifndef TRACY_NO_STATISTICS
if( m_worker.AreSourceLocationZonesReady() )
{
auto& slz = m_worker.GetZonesForSourceLocation( zone.SrcLoc() );
if( !slz.zones.empty() )
{
auto it = std::lower_bound( slz.zones.begin(), slz.zones.end(), zone.Start(), [] ( const auto& lhs, const auto& rhs ) { return lhs.Zone()->Start() < rhs; } );
if( it != slz.zones.end() && it->Zone() == &zone )
{
return m_worker.GetThreadData( m_worker.DecompressThread( it->Thread() ) );
}
}
}
#endif
for( const auto& thread : m_worker.GetThreadData() ) for( const auto& thread : m_worker.GetThreadData() )
{ {
const Vector<short_ptr<ZoneEvent>>* timeline = &thread->timeline; const Vector<short_ptr<ZoneEvent>>* timeline = &thread->timeline;