mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Allow calculating zone depth.
This commit is contained in:
parent
cdc4575dba
commit
2714152f84
@ -12222,6 +12222,24 @@ void View::CrashTooltip()
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
int View::GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const
|
||||
{
|
||||
auto td = m_worker.GetThreadData( tid );
|
||||
assert( td );
|
||||
auto timeline = &td->timeline;
|
||||
int depth = 0;
|
||||
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;
|
||||
assert( !( zone.end >= 0 && (*it)->Start() > zone.end ) );
|
||||
if( *it == &zone ) return depth;
|
||||
assert( (*it)->child >= 0 );
|
||||
timeline = &m_worker.GetZoneChildren( (*it)->child );
|
||||
depth++;
|
||||
}
|
||||
}
|
||||
|
||||
const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const
|
||||
{
|
||||
for( const auto& thread : m_worker.GetThreadData() )
|
||||
|
@ -178,6 +178,7 @@ private:
|
||||
void CallstackTooltip( uint32_t idx );
|
||||
void CrashTooltip();
|
||||
|
||||
int GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const;
|
||||
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
|
||||
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
|
||||
const ThreadData* GetZoneThreadData( const ZoneEvent& zone ) const;
|
||||
|
Loading…
Reference in New Issue
Block a user