From 6cfd53b274532f56fb8acca50157a8044c257669 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 27 Sep 2018 23:16:10 +0200 Subject: [PATCH] Add allocations list window. --- server/TracyView.cpp | 14 +++++++++++++- server/TracyView.hpp | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1dc6cb40..312aee67 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -695,6 +695,7 @@ bool View::DrawImpl() if( m_findZone.show ) DrawFindZone(); if( m_showStatistics ) DrawStatistics(); if( m_memInfo.show ) DrawMemory(); + if( m_memInfo.showAllocList ) DrawAllocList(); if( m_compare.show ) DrawCompare(); if( m_callstackInfoWindow != 0 ) DrawCallstackWindow(); if( m_memoryAllocInfoWindow >= 0 ) DrawMemoryAllocWindow(); @@ -7517,7 +7518,7 @@ void View::DrawMemory() #endif { ImGui::TextDisabled( "Press ctrl key to display allocation info tooltip." ); - ImGui::TextDisabled( "Right click on file name to open source file." ); + ImGui::TextDisabled( "Right click on function name to display allocations list. Right click on file name to open source file." ); auto& mem = m_worker.GetMemData(); auto tree = GetCallstackFrameTree( mem ); @@ -7566,6 +7567,7 @@ void View::DrawFrameTreeLevel( std::vector& tree, int& idx ) { auto& mem = m_worker.GetMemData().data; const auto sz = mem.size(); + m_memInfo.showAllocList = true; m_memInfo.allocList.clear(); for( size_t i=0; i& tree, int& idx ) } } +void View::DrawAllocList() +{ + ImGui::Begin( "Allocations list", &m_memInfo.showAllocList ); + TextFocused( "Number of allocations:", RealToString( m_memInfo.allocList.size(), true ) ); + ListMemData( m_memInfo.allocList.begin(), m_memInfo.allocList.end(), [this]( auto& v ) { + ImGui::Text( "0x%" PRIx64, (*v)->ptr ); + }, "##allocations" ); + ImGui::End(); +} + std::pair View::GetMemoryPages() const { const auto& mem = m_worker.GetMemData(); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index c75811ec..23150f09 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -93,6 +93,7 @@ private: void DrawFindZone(); void DrawStatistics(); void DrawMemory(); + void DrawAllocList(); void DrawCompare(); void DrawCallstackWindow(); void DrawMemoryAllocWindow(); @@ -402,6 +403,7 @@ private: char pattern[1024] = {}; uint64_t ptrFind = 0; bool restrictTime = false; + bool showAllocList = false; std::vector allocList; } m_memInfo;