Indicate that memory limit was hit with notification triangle color.

This commit is contained in:
Bartosz Taudul 2024-05-05 21:07:50 +02:00
parent 89f1fb4825
commit 68473381b9
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -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();
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();
}
}