Allow retrieval of zone's thread data.

This commit is contained in:
Bartosz Taudul 2019-03-17 16:17:47 +01:00
parent b4bfdb7872
commit 016f7ac4b6
2 changed files with 10 additions and 3 deletions

View File

@ -9824,7 +9824,7 @@ const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
return nullptr;
}
uint64_t View::GetZoneThread( const ZoneEvent& zone ) const
const ThreadData* View::GetZoneThreadData( const ZoneEvent& zone ) const
{
for( const auto& thread : m_worker.GetThreadData() )
{
@ -9835,12 +9835,18 @@ uint64_t View::GetZoneThread( const ZoneEvent& zone ) const
auto it = std::upper_bound( timeline->begin(), timeline->end(), zone.start, [] ( const auto& l, const auto& r ) { return l < r->start; } );
if( it != timeline->begin() ) --it;
if( zone.end >= 0 && (*it)->start > zone.end ) break;
if( *it == &zone ) return thread->id;
if( *it == &zone ) return thread;
if( (*it)->child < 0 ) break;
timeline = &m_worker.GetZoneChildren( (*it)->child );
}
}
return 0;
return nullptr;
}
uint64_t View::GetZoneThread( const ZoneEvent& zone ) const
{
auto threadData = GetZoneThreadData( zone );
return threadData ? threadData->id : 0;
}
uint64_t View::GetZoneThread( const GpuEvent& zone ) const

View File

@ -162,6 +162,7 @@ private:
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
const ThreadData* GetZoneThreadData( const ZoneEvent& zone ) const;
uint64_t GetZoneThread( const ZoneEvent& zone ) const;
uint64_t GetZoneThread( const GpuEvent& zone ) const;
const GpuCtxData* GetZoneCtx( const GpuEvent& zone ) const;