mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Add functionality for getting zone thread.
This commit is contained in:
parent
616269e849
commit
d08c10c5b6
@ -3464,6 +3464,25 @@ const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint64_t View::GetZoneThread( const ZoneEvent& zone ) const
|
||||
{
|
||||
for( const auto& thread : m_worker.GetThreadData() )
|
||||
{
|
||||
const Vector<ZoneEvent*>* timeline = &thread->timeline;
|
||||
if( timeline->empty() ) continue;
|
||||
for(;;)
|
||||
{
|
||||
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 != -1 && (*it)->start > zone.end ) break;
|
||||
if( *it == &zone ) return thread->id;
|
||||
if( (*it)->child.empty() ) break;
|
||||
timeline = &(*it)->child;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
void View::FindZones()
|
||||
{
|
||||
|
@ -96,6 +96,7 @@ private:
|
||||
void ZoneTooltip( const GpuEvent& ev );
|
||||
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
|
||||
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
|
||||
uint64_t GetZoneThread( const ZoneEvent& zone ) const;
|
||||
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
void FindZones();
|
||||
|
Loading…
Reference in New Issue
Block a user