mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Recursive, incomplete zone insertion into timeline.
This commit is contained in:
parent
b89adbaf8c
commit
73df330dd5
@ -224,7 +224,6 @@ void View::ProcessZoneBegin( uint64_t id, const QueueZoneBegin& ev )
|
||||
{
|
||||
auto it = m_pendingEndZone.find( id );
|
||||
auto zone = m_slab.Alloc<Event>();
|
||||
zone->parent = nullptr;
|
||||
|
||||
CheckString( ev.filename );
|
||||
CheckString( ev.function );
|
||||
@ -360,22 +359,7 @@ void View::NewZone( Event* zone, uint64_t thread )
|
||||
timeline = &m_threads[it->second].timeline;
|
||||
}
|
||||
|
||||
if( !timeline->empty() )
|
||||
{
|
||||
const auto lastend = timeline->back()->end;
|
||||
if( lastend != -1 && lastend < zone->start )
|
||||
{
|
||||
timeline->push_back( zone );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
timeline->push_back( zone );
|
||||
}
|
||||
InsertZone( zone, nullptr, *timeline );
|
||||
}
|
||||
|
||||
void View::UpdateZone( Event* zone )
|
||||
@ -383,6 +367,37 @@ void View::UpdateZone( Event* zone )
|
||||
assert( zone->end != -1 );
|
||||
}
|
||||
|
||||
void View::InsertZone( Event* zone, Event* parent, Vector<Event*>& vec )
|
||||
{
|
||||
if( !vec.empty() )
|
||||
{
|
||||
const auto lastend = vec.back()->end;
|
||||
if( lastend != -1 && lastend < zone->start )
|
||||
{
|
||||
zone->parent = parent;
|
||||
vec.push_back( zone );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = std::upper_bound( vec.begin(), vec.end(), zone->start, [] ( const auto& l, const auto& r ) { return l < r->start; } );
|
||||
if( it == vec.end() )
|
||||
{
|
||||
assert( vec.back()->end == -1 );
|
||||
InsertZone( zone, vec.back(), vec.back()->child );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
zone->parent = parent;
|
||||
vec.push_back( zone );
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t View::GetFrameTime( size_t idx ) const
|
||||
{
|
||||
if( idx < m_frames.size() - 1 )
|
||||
|
@ -57,6 +57,8 @@ private:
|
||||
void NewZone( Event* zone, uint64_t thread );
|
||||
void UpdateZone( Event* zone );
|
||||
|
||||
void InsertZone( Event* zone, Event* parent, Vector<Event*>& vec );
|
||||
|
||||
uint64_t GetFrameTime( size_t idx ) const;
|
||||
uint64_t GetFrameBegin( size_t idx ) const;
|
||||
uint64_t GetFrameEnd( size_t idx ) const;
|
||||
|
Loading…
Reference in New Issue
Block a user