mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Implement direct children search.
This commit is contained in:
parent
57f03dfe9a
commit
f7598d2431
@ -291,6 +291,7 @@ private:
|
||||
|
||||
const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const;
|
||||
const ZoneEvent* GetZoneParent( const ZoneEvent& zone, uint64_t tid ) const;
|
||||
const ZoneEvent* GetZoneChild( const ZoneEvent& zone, int64_t time ) const;
|
||||
bool IsZoneReentry( const ZoneEvent& zone ) const;
|
||||
bool IsZoneReentry( const ZoneEvent& zone, uint64_t tid ) const;
|
||||
const GpuEvent* GetZoneParent( const GpuEvent& zone ) const;
|
||||
|
@ -194,6 +194,27 @@ const ZoneEvent* View::FindZoneAtTime( uint64_t thread, int64_t time ) const
|
||||
}
|
||||
}
|
||||
|
||||
const ZoneEvent* View::GetZoneChild( const ZoneEvent& zone, int64_t time ) const
|
||||
{
|
||||
if( !zone.HasChildren() ) return nullptr;
|
||||
auto& children = m_worker.GetZoneChildren( zone.Child() );
|
||||
if( children.is_magic() )
|
||||
{
|
||||
auto& vec = *((Vector<ZoneEvent>*)&children);
|
||||
auto it = std::upper_bound( vec.begin(), vec.end(), time, [] ( const auto& l, const auto& r ) { return l < r.Start(); } );
|
||||
if( it != vec.begin() ) --it;
|
||||
if( it->Start() > time || ( it->IsEndValid() && it->End() < time ) ) return nullptr;
|
||||
return it;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = std::upper_bound( children.begin(), children.end(), time, [] ( const auto& l, const auto& r ) { return l < r->Start(); } );
|
||||
if( it != children.begin() ) --it;
|
||||
if( (*it)->Start() > time || ( (*it)->IsEndValid() && (*it)->End() < time ) ) return nullptr;
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
|
||||
const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const
|
||||
{
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
|
@ -881,11 +881,7 @@ void View::DrawZoneInfoWindow()
|
||||
ImGui::TableHeadersRow();
|
||||
do
|
||||
{
|
||||
if( m_messagesExcludeChildren )
|
||||
{
|
||||
auto msgzone = FindZoneAtTime( tid, (*msgit)->time );
|
||||
if( msgzone != &ev ) continue;
|
||||
}
|
||||
if( m_messagesExcludeChildren && GetZoneChild( ev, (*msgit)->time ) ) continue;
|
||||
ImGui::PushID( *msgit );
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
|
Loading…
Reference in New Issue
Block a user