From dcddf8898b0e8a9006aaf1df670da5dff4a17d42 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 13 Nov 2020 17:22:10 +0100 Subject: [PATCH] Display memory usage also as a percentage. --- server/TracyView.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 7e5db1e3..56a3205a 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -919,6 +919,19 @@ bool View::DrawImpl() ImGui::Text( "Profiler memory usage" ); ImGui::EndTooltip(); } + if( m_totalMemory != 0 ) + { + ImGui::SameLine(); + const auto memUse = float( memUsage ) / m_totalMemory * 100; + if( memUse < 80 ) + { + ImGui::TextDisabled( "(%.2f%%)", memUse ); + } + else + { + ImGui::TextColored( ImVec4( 1.f, 0.25f, 0.25f, 1.f ), "(%.2f%%)", memUse ); + } + } ImGui::SameLine(); dx = ImGui::GetCursorPosX() - cx; if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );