Parent vector retrieval.

This commit is contained in:
Bartosz Taudul 2017-09-24 03:23:01 +02:00
parent 1005fa0c91
commit 6419cd5062
2 changed files with 21 additions and 0 deletions

View File

@ -486,6 +486,26 @@ uint64_t View::GetZoneEnd( const Event& ev ) const
} }
} }
Vector<Event*>& View::GetParentVector( const Event& ev )
{
// here be dragons
if( ev.parent )
{
return ev.parent->child;
}
else
{
for( auto& t : m_threads )
{
auto it = std::lower_bound( t.timeline.begin(), t.timeline.end(), ev.start, [] ( const auto& l, const auto& r ) { return l->start < r; } );
if( it != t.timeline.end() && *it == &ev ) return t.timeline;
}
assert( false );
static Vector<Event*> empty;
return empty;
}
}
const char* View::TimeToString( uint64_t ns ) const const char* View::TimeToString( uint64_t ns ) const
{ {
enum { Pool = 4 }; enum { Pool = 4 };

View File

@ -66,6 +66,7 @@ private:
uint64_t GetFrameEnd( size_t idx ) const; uint64_t GetFrameEnd( size_t idx ) const;
uint64_t GetLastTime() const; uint64_t GetLastTime() const;
uint64_t GetZoneEnd( const Event& ev ) const; uint64_t GetZoneEnd( const Event& ev ) const;
Vector<Event*>& GetParentVector( const Event& ev );
const char* TimeToString( uint64_t ns ) const; const char* TimeToString( uint64_t ns ) const;
const char* GetString( uint64_t ptr ) const; const char* GetString( uint64_t ptr ) const;
const char* GetThreadString( uint64_t id ) const; const char* GetThreadString( uint64_t id ) const;