Skip to content

Commit 775c268

Browse files
committed
Set memory tooltip to three significant figures
- Fixed the value so that it correctly reports the value as a percentage from 0 to 100 - Removed the `fixed` parameter, so that the number of significant figures applies to the whole value instead of just the value after the decimal
1 parent 770fbaa commit 775c268

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/Devices/MemoryMonitor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ void MemoryMonitorUsage::timerCallback()
3636
{
3737
if (device != nullptr)
3838
{
39-
auto logMemoryUsed = std::log(device->getLastPercentUsedValue() + 1) / maxLogarithmicValue;
39+
auto memoryUsedPercent = device->getLastPercentUsedValue();
40+
auto logMemoryUsed = std::log(memoryUsedPercent + 1) / maxLogarithmicValue;
4041
setFillPercentage(logMemoryUsed);
41-
setTooltip(getNewTooltip(logMemoryUsed));
42+
setTooltip(getNewTooltip(memoryUsedPercent));
4243
repaint();
4344
}
4445
}
4546

4647
std::string MemoryMonitorUsage::getNewTooltip(float memoryUsage)
4748
{
4849
std::stringstream ss;
49-
ss.precision(2);
50-
ss << std::fixed << "Memory Used: " << memoryUsage << "%";
50+
ss << "Memory Used: " << std::setprecision(3) << memoryUsage << "%";
5151
return ss.str();
5252
}
5353

0 commit comments

Comments
 (0)