From 973fd941d528448750b6e324538c52e8d86ad1bf Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 15 Nov 2019 19:59:13 +0100 Subject: [PATCH] Extract call stack calls drawing functionality. --- server/TracyView.cpp | 55 ++++++++++++++++++++++++-------------------- server/TracyView.hpp | 1 + 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 12ac8e04..a71c3e2d 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -7787,31 +7787,7 @@ void View::DrawMessages() SmallCallstackButton( "Show", cs, idx ); #endif ImGui::SameLine(); - const auto& csdata = m_worker.GetCallstack( cs ); - const auto cssz = std::min( csdata.size(), 4 ); - bool first = true; - for( int i=0; idata[frameData->size - 1]; - auto txt = m_worker.GetString( frame.name ); - ImGui::TextUnformatted( txt ); - } + DrawCallstackCalls( cs, 4 ); } ImGui::NextColumn(); msgcnt++; @@ -13967,6 +13943,35 @@ void View::SmallCallstackButton( const char* name, uint32_t callstack, int& idx, } } +void View::DrawCallstackCalls( uint32_t callstack, uint8_t limit ) const +{ + const auto& csdata = m_worker.GetCallstack( callstack ); + const auto cssz = std::min( csdata.size(), limit ); + bool first = true; + for( uint8_t i=0; idata[frameData->size - 1]; + auto txt = m_worker.GetString( frame.name ); + ImGui::TextUnformatted( txt ); + } +} + void View::SetViewToLastFrames() { const int total = m_worker.GetFrameCount( *m_frames ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 7ba212ad..74742c58 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -222,6 +222,7 @@ private: const char* GetPlotName( const PlotData* plot ) const; void SmallCallstackButton( const char* name, uint32_t callstack, int& idx, bool tooltip = true ); + void DrawCallstackCalls( uint32_t callstack, uint8_t limit ) const; void SetViewToLastFrames(); int64_t GetZoneChildTime( const ZoneEvent& zone ); int64_t GetZoneChildTime( const GpuEvent& zone );