GPU zone thread getter.

This commit is contained in:
Bartosz Taudul 2018-03-19 16:11:37 +01:00
parent 5a32cd7984
commit 0f6ec65b65
2 changed files with 20 additions and 0 deletions

View File

@ -3542,6 +3542,25 @@ uint64_t View::GetZoneThread( const ZoneEvent& zone ) const
return 0;
}
uint64_t View::GetZoneThread( const GpuEvent& zone ) const
{
for( const auto& ctx : m_worker.GetGpuData() )
{
const Vector<GpuEvent*>* timeline = &ctx->timeline;
if( timeline->empty() ) continue;
for(;;)
{
auto it = std::upper_bound( timeline->begin(), timeline->end(), zone.gpuStart, [] ( const auto& l, const auto& r ) { return l < r->gpuStart; } );
if( it != timeline->begin() ) --it;
if( zone.gpuEnd != -1 && (*it)->gpuStart > zone.gpuEnd ) break;
if( *it == &zone ) return ctx->thread;
if( (*it)->child.empty() ) break;
timeline = &(*it)->child;
}
}
return 0;
}
#ifndef TRACY_NO_STATISTICS
void View::FindZones()
{

View File

@ -97,6 +97,7 @@ private:
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
uint64_t GetZoneThread( const ZoneEvent& zone ) const;
uint64_t GetZoneThread( const GpuEvent& zone ) const;
#ifndef TRACY_NO_STATISTICS
void FindZones();