From d98e08b37a3a3c36611fd0a42a994f01b13da3f7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 24 Sep 2017 03:29:22 +0200 Subject: [PATCH] Implement zone update code. --- server/TracyView.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 5e0d31e6..6983efff 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -365,6 +365,20 @@ void View::NewZone( Event* zone, uint64_t thread ) void View::UpdateZone( Event* zone ) { assert( zone->end != -1 ); + auto it = std::upper_bound( zone->child.begin(), zone->child.end(), zone->end, [] ( const auto& l, const auto& r ) { return l < r->start; } ); + if( it == zone->child.end() ) return; + + // here be dragons + auto& pvec = GetParentVector( *zone ); + auto pit = std::lower_bound( pvec.begin(), pvec.end(), zone->start, [] ( const auto& l, const auto& r ) { return l->start < r; } ); + assert( *pit == zone ); + ++pit; + for( auto eit = it; eit != zone->child.end(); ++eit ) + { + (*eit)->parent = zone->parent; + pit = pvec.insert( pit, *eit ); + } + zone->child.erase( it, zone->child.end() ); } void View::InsertZone( Event* zone, Event* parent, Vector& vec )