From cdab2297ef5ec4ef9d7ef23f93d034ada3f81d3b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 23 Sep 2017 15:41:10 +0200 Subject: [PATCH] Non-recursive version of GetZoneEnd. --- server/TracyView.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index ca443ed5..75803915 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -437,9 +437,13 @@ uint64_t View::GetLastTime() const uint64_t View::GetZoneEnd( const Event& ev ) const { - if( ev.end != -1 ) return ev.end; - if( ev.child.empty() ) return ev.start; - return GetZoneEnd( *ev.child.back() ); + auto ptr = &ev; + for(;;) + { + if( ptr->end != -1 ) return ptr->end; + if( ptr->child.empty() ) return ptr->start; + ptr = ptr->child.back(); + } } const char* View::TimeToString( uint64_t ns ) const