From 118fab15612d319b2957d29f3360544600fb5bd5 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 23 Jan 2019 13:59:14 +0100 Subject: [PATCH] Fast version of zone child time getter. This one can only be used when all child zones are properly ended. --- server/TracyView.cpp | 14 ++++++++++++++ server/TracyView.hpp | 1 + 2 files changed, 15 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index ce0de085..eb83b373 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -8730,4 +8730,18 @@ int64_t View::GetZoneChildTime( const ZoneEvent& zone ) return time; } +int64_t View::GetZoneChildTimeFast( const ZoneEvent& zone ) +{ + int64_t time = 0; + if( zone.child >= 0 ) + { + for( auto& v : m_worker.GetZoneChildren( zone.child ) ) + { + assert( v->end >= 0 ); + time += v->end - v->start; + } + } + return time; +} + } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index abee0eb7..89b8be3b 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -162,6 +162,7 @@ private: void SmallCallstackButton( const char* name, uint32_t callstack, int& idx ); void SetViewToLastFrames(); int64_t GetZoneChildTime( const ZoneEvent& zone ); + int64_t GetZoneChildTimeFast( const ZoneEvent& zone ); flat_hash_map> m_visible; flat_hash_map> m_visibleMsgThread;