From 68473381b9ba0ac958cf1aaf37b504a33e1c06b4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 5 May 2024 21:07:50 +0200 Subject: [PATCH] Indicate that memory limit was hit with notification triangle color. --- profiler/src/profiler/TracyView.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 2bcb60f4..2a8e7293 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -998,14 +998,22 @@ bool View::DrawImpl() if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize ); ImGui::Spacing(); - if( m_worker.GetMemoryLimit() > 0 ) + const auto memoryLimit = m_worker.GetMemoryLimit(); + if( memoryLimit > 0 ) { ImGui::SameLine(); - TextColoredUnformatted( 0xFF00FFFF, ICON_FA_TRIANGLE_EXCLAMATION ); + if( memUsage.load( std::memory_order_relaxed ) > memoryLimit ) + { + TextColoredUnformatted( 0xFF2222FF, ICON_FA_TRIANGLE_EXCLAMATION ); + } + else + { + TextColoredUnformatted( 0xFF00FFFF, ICON_FA_TRIANGLE_EXCLAMATION ); + } if( ImGui::IsItemHovered() ) { ImGui::BeginTooltip(); - ImGui::Text( "Memory limit: %s", MemSizeToString( m_worker.GetMemoryLimit() ) ); + ImGui::Text( "Memory limit: %s", MemSizeToString( memoryLimit ) ); ImGui::EndTooltip(); } }