From bf249de26675c519e4d90c906c9c79d465b11545 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 2 Apr 2018 16:30:03 +0200 Subject: [PATCH] Display memory usage by active allocations. --- server/TracyView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 52b33b1e..f2ab9915 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3902,6 +3902,7 @@ void View::DrawMemory() ImGui::Separator(); if( ImGui::TreeNode( "Active allocations" ) ) { + uint64_t total = 0; std::vector items; items.reserve( mem.active.size() ); if( m_memInfo.restrictTime ) @@ -3911,6 +3912,7 @@ void View::DrawMemory() if( v->timeAlloc < zvMid && ( v->timeFree > zvMid || v->timeFree < 0 ) ) { items.emplace_back( v ); + total += v->size; } } } @@ -3921,10 +3923,12 @@ void View::DrawMemory() items.emplace_back( v.second ); } pdqsort_branchless( items.begin(), items.end(), []( const auto& lhs, const auto& rhs ) { return lhs->timeAlloc < rhs->timeAlloc; } ); + total = mem.usage; } ImGui::SameLine(); ImGui::TextDisabled( "(%s)", RealToString( items.size(), true ) ); + ImGui::Text( "Memory usage: %s", RealToString( total, true ) ); ListMemData( items.begin(), items.end(), []( auto& v ) { ImGui::Text( "0x%" PRIx64, (*v)->ptr );