From bf52b3bc98ab99be92a24a25b5f927592662a62d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 28 Mar 2018 01:47:28 +0200 Subject: [PATCH] Add zone trace. --- server/TracyView.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 66d4c81d..89af876f 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -2450,6 +2450,34 @@ void View::DrawZoneInfoWindow() ImGui::Text( "Execution time: %s", TimeToString( ztime ) ); ImGui::Text( "Without profiling: %s", TimeToString( ztime - m_worker.GetDelay() * dmul ) ); + ImGui::Separator(); + + std::vector zoneTrace; + auto parent = GetZoneParent( ev ); + while( parent ) + { + zoneTrace.emplace_back( parent ); + parent = GetZoneParent( *parent ); + } + if( !zoneTrace.empty() ) + { + bool expand = ImGui::TreeNode( "Zone trace" ); + ImGui::SameLine(); + ImGui::TextDisabled( "(%s)", RealToString( zoneTrace.size(), true ) ); + if( expand ) + { + for( auto& v : zoneTrace ) + { + const auto& srcloc = m_worker.GetSourceLocation( v->srcloc ); + const auto txt = srcloc.name.active ? m_worker.GetString( srcloc.name ) : m_worker.GetString( srcloc.function ); + ImGui::Text( "%s", txt ); + ImGui::SameLine(); + ImGui::TextDisabled( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line ); + } + ImGui::TreePop(); + } + } + auto ctt = std::make_unique( ev.child.size() ); auto cti = std::make_unique( ev.child.size() ); uint64_t ctime = 0; @@ -2562,6 +2590,34 @@ void View::DrawGpuInfoWindow() ImGui::Text( "CPU command setup time: %s", TimeToString( ev.cpuEnd - ev.cpuStart ) ); ImGui::Text( "Delay to execution: %s", TimeToString( ev.gpuStart - ev.cpuStart ) ); + ImGui::Separator(); + + std::vector zoneTrace; + auto parent = GetZoneParent( ev ); + while( parent ) + { + zoneTrace.emplace_back( parent ); + parent = GetZoneParent( *parent ); + } + if( !zoneTrace.empty() ) + { + bool expand = ImGui::TreeNode( "Zone trace" ); + ImGui::SameLine(); + ImGui::TextDisabled( "(%s)", RealToString( zoneTrace.size(), true ) ); + if( expand ) + { + for( auto& v : zoneTrace ) + { + const auto& srcloc = m_worker.GetSourceLocation( v->srcloc ); + const auto txt = srcloc.name.active ? m_worker.GetString( srcloc.name ) : m_worker.GetString( srcloc.function ); + ImGui::Text( "%s", txt ); + ImGui::SameLine(); + ImGui::TextDisabled( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line ); + } + ImGui::TreePop(); + } + } + auto ctt = std::make_unique( ev.child.size() ); auto cti = std::make_unique( ev.child.size() ); uint64_t ctime = 0;