Display memory usage also as a percentage.

This commit is contained in:
Bartosz Taudul 2020-11-13 17:22:10 +01:00
parent 2bf00b5eab
commit dcddf8898b

View File

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