mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Implement getting zone parent when thread id is known.
This commit is contained in:
parent
456deefdbc
commit
c0df3dd965
@ -13237,6 +13237,25 @@ const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone, uint64_t tid ) const
|
||||||
|
{
|
||||||
|
const auto thread = m_worker.GetThreadData( tid );
|
||||||
|
const ZoneEvent* parent = nullptr;
|
||||||
|
const Vector<ZoneEvent*>* timeline = &thread->timeline;
|
||||||
|
if( timeline->empty() ) return nullptr;
|
||||||
|
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() >= 0 && (*it)->Start() > zone.End() ) break;
|
||||||
|
if( *it == &zone ) return parent;
|
||||||
|
if( (*it)->Child() < 0 ) break;
|
||||||
|
parent = *it;
|
||||||
|
timeline = &m_worker.GetZoneChildren( parent->Child() );
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
|
const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
|
||||||
{
|
{
|
||||||
for( const auto& ctx : m_worker.GetGpuData() )
|
for( const auto& ctx : m_worker.GetGpuData() )
|
||||||
|
@ -191,6 +191,7 @@ private:
|
|||||||
|
|
||||||
int GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const;
|
int GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const;
|
||||||
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
|
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
|
||||||
|
const ZoneEvent* GetZoneParent( const ZoneEvent& zone, uint64_t tid ) const;
|
||||||
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
|
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
|
||||||
const ThreadData* GetZoneThreadData( const ZoneEvent& zone ) const;
|
const ThreadData* GetZoneThreadData( const ZoneEvent& zone ) const;
|
||||||
uint64_t GetZoneThread( const ZoneEvent& zone ) const;
|
uint64_t GetZoneThread( const ZoneEvent& zone ) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user