From 4ba95145dae7f7365d1794ea6a38bcfe5b89ac9c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 19 Jun 2018 22:19:33 +0200 Subject: [PATCH] Display raw callstack payload. --- server/TracyView.cpp | 44 +++++++++++++++++++++++++++++++++++++++++++- server/TracyView.hpp | 2 ++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 3fe31967..4d5aa247 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -4774,7 +4774,7 @@ void View::ListMemData( T ptr, T end, std::function DrawAdd const auto ty = ImGui::GetTextLineHeight() + style.ItemSpacing.y; ImGui::BeginChild( "##memScroll", ImVec2( 0, std::max( ty * std::min( dist, 5 ), std::min( ty * dist, ImGui::GetContentRegionAvail().y ) ) ) ); - ImGui::Columns( 7 ); + ImGui::Columns( 8 ); ImGui::Text( "Address" ); ImGui::NextColumn(); ImGui::Text( "Size" ); @@ -4815,6 +4815,8 @@ void View::ListMemData( T ptr, T end, std::function DrawAdd ImGui::EndTooltip(); } ImGui::NextColumn(); + ImGui::Text( "Callstack" ); + ImGui::NextColumn(); ImGui::Separator(); int idx = 0; while( ptr != end ) @@ -4918,6 +4920,34 @@ void View::ListMemData( T ptr, T end, std::function DrawAdd } } ImGui::NextColumn(); + if( v->csAlloc == 0 ) + { + ImGui::TextDisabled( "[alloc]" ); + } + else + { + ImGui::Text( "[alloc]" ); + if( ImGui::IsItemHovered() ) + { + CallstackTooltip( v->csAlloc ); + } + } + ImGui::SameLine(); + ImGui::Spacing(); + ImGui::SameLine(); + if( v->csFree == 0 ) + { + ImGui::TextDisabled( "[free]" ); + } + else + { + ImGui::Text( "[free]" ); + if( ImGui::IsItemHovered() ) + { + CallstackTooltip( v->csFree ); + } + } + ImGui::NextColumn(); ptr++; } ImGui::EndColumns(); @@ -5537,6 +5567,18 @@ void View::ZoneTooltip( const GpuEvent& ev ) ImGui::EndTooltip(); } +void View::CallstackTooltip( uint32_t idx ) +{ + auto& cs = m_worker.GetCallstack( idx ); + + ImGui::BeginTooltip(); + for( auto& entry : cs ) + { + ImGui::Text( "0x%" PRIX64, entry ); + } + ImGui::EndTooltip(); +} + const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const { for( const auto& thread : m_worker.GetThreadData() ) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index a5ad55ff..ba3cf7d4 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -110,6 +110,8 @@ private: void ZoneTooltip( const ZoneEvent& ev ); void ZoneTooltip( const GpuEvent& ev ); + void CallstackTooltip( uint32_t idx ); + const ZoneEvent* GetZoneParent( const ZoneEvent& zone ) const; const GpuEvent* GetZoneParent( const GpuEvent& zone ) const; uint64_t GetZoneThread( const ZoneEvent& zone ) const;