From 115c66324d56dbd22c882887981bd4691d789492 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 25 Dec 2019 15:07:52 +0100 Subject: [PATCH] Add inclusive time display to time distribution. --- server/TracyView.cpp | 26 +++++++++++++++++--------- server/TracyView.hpp | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 9b9cd0c8..751f874c 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -5589,10 +5589,13 @@ template void View::CalcZoneTimeDataImpl( const V& children, flat_hash_map>& data, flat_hash_map>::iterator zit, const ZoneEvent& zone ) { Adapter a; - for( auto& child : children ) + if( m_timeDist.exclusiveTime ) { - const auto t = m_worker.GetZoneEnd( a(child) ) - a(child).Start(); - zit->second.time -= t; + for( auto& child : children ) + { + const auto t = m_worker.GetZoneEnd( a(child) ) - a(child).Start(); + zit->second.time -= t; + } } for( auto& child : children ) { @@ -5630,13 +5633,16 @@ template void View::CalcZoneTimeDataImpl( const V& children, const ContextSwitch* ctx, flat_hash_map>& data, flat_hash_map>::iterator zit, const ZoneEvent& zone ) { Adapter a; - for( auto& child : children ) + if( m_timeDist.exclusiveTime ) { - int64_t t; - uint64_t cnt; - const auto res = GetZoneRunningTime( ctx, a(child), t, cnt ); - assert( res ); - zit->second.time -= t; + for( auto& child : children ) + { + int64_t t; + uint64_t cnt; + const auto res = GetZoneRunningTime( ctx, a(child), t, cnt ); + assert( res ); + zit->second.time -= t; + } } for( auto& child : children ) { @@ -6302,6 +6308,8 @@ void View::DrawZoneInfoWindow() bool expand = ImGui::TreeNode( "Time distribution" ); if( expand ) { + ImGui::SameLine(); + if( SmallCheckbox( "Exclusive time", &m_timeDist.exclusiveTime ) ) m_timeDist.dataValidFor = nullptr; if( ctx ) { ImGui::SameLine(); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 3aadc72c..f74f0d92 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -603,6 +603,7 @@ private: enum class SortBy : int { Count, Time, Mtpc }; SortBy sortBy = SortBy::Time; bool runningTime = false; + bool exclusiveTime = true; flat_hash_map> data; const ZoneEvent* dataValidFor = nullptr; float fztime;