float to uint64 conversion
This commit is contained in:
@@ -85,8 +85,8 @@ namespace display::ui::hostblock
|
||||
|
||||
// ===== Memory bar =====
|
||||
float memValue, swapValue = 0.0f;
|
||||
if (metrics.memory.mem_total > 0)
|
||||
memValue = metrics.memory.mem_used / metrics.memory.mem_total;
|
||||
if (metrics.memory.memory.total > 0)
|
||||
memValue = metrics.memory.memory.used / metrics.memory.memory.total;
|
||||
|
||||
memBar.draw(
|
||||
fb,
|
||||
@@ -96,16 +96,16 @@ namespace display::ui::hostblock
|
||||
text.drawTextOutlined(fb,
|
||||
x + MEM_BAR_TEXT_PADDING_X,
|
||||
cursorY + 8,
|
||||
"MEM: " + display::ui::text::formatFloat(metrics.memory.mem_used / 1073741824) + "/" + display::ui::text::formatFloat(metrics.memory.mem_total / 1073741824),
|
||||
"MEM: " + display::ui::text::formatFloat(metrics.memory.memory.used / 1073741824) + "/" + display::ui::text::formatFloat(metrics.memory.memory.total / 1073741824),
|
||||
display::ui::theme::text::TEXT,
|
||||
display::ui::theme::text::OUTLINE,
|
||||
display::ui::text::Font{"PixelFive-Regular", 5});
|
||||
|
||||
cursorY += MEM_BAR_HEIGHT + SECTION_GAP;
|
||||
|
||||
if (metrics.memory.swap_total > 0)
|
||||
if (metrics.memory.swap.total > 0)
|
||||
{
|
||||
swapValue = metrics.memory.swap_used / metrics.memory.swap_total;
|
||||
swapValue = metrics.memory.swap.used / metrics.memory.swap.total;
|
||||
|
||||
memBar.draw(
|
||||
fb,
|
||||
@@ -115,7 +115,7 @@ namespace display::ui::hostblock
|
||||
text.drawTextOutlined(fb,
|
||||
x + MEM_BAR_TEXT_PADDING_X,
|
||||
cursorY + 8,
|
||||
"SWP: " + display::ui::text::formatFloat(metrics.memory.swap_used / 1073741824) + "/" + display::ui::text::formatFloat(metrics.memory.swap_total / 1073741824),
|
||||
"SWP: " + display::ui::text::formatFloat(metrics.memory.swap.used / 1073741824) + "/" + display::ui::text::formatFloat(metrics.memory.swap.total / 1073741824),
|
||||
display::ui::theme::text::TEXT,
|
||||
display::ui::theme::text::OUTLINE,
|
||||
display::ui::text::Font{"PixelFive-Regular", 5});
|
||||
@@ -131,13 +131,13 @@ namespace display::ui::hostblock
|
||||
int by = cursorY +
|
||||
i * (MEM_BAR_HEIGHT + SECTION_GAP);
|
||||
|
||||
float value = std::clamp(metrics.disks[i].used / metrics.disks[i].total, 0.0f, 1.0f);
|
||||
float value = std::clamp(static_cast<float>(metrics.disks[i].metrics.used) / metrics.disks[i].metrics.total, 0.0f, 1.0f);
|
||||
|
||||
memBar.draw(fb, x + PADDING, by, value);
|
||||
text.drawTextOutlined(fb,
|
||||
x + MEM_BAR_TEXT_PADDING_X,
|
||||
by + 8,
|
||||
"D/" + metrics.disks[i].name + ": " + display::ui::text::formatFloat(metrics.disks[i].used / 1073741824) + "/" + display::ui::text::formatFloat(metrics.disks[i].total / 1073741824),
|
||||
"D/" + metrics.disks[i].name + ": " + display::ui::text::formatFloat(metrics.disks[i].metrics.used / 1073741824) + "/" + display::ui::text::formatFloat(metrics.disks[i].metrics.total / 1073741824),
|
||||
display::ui::theme::text::TEXT,
|
||||
display::ui::theme::text::OUTLINE,
|
||||
display::ui::text::Font{"PixelFive-Regular", 5});
|
||||
|
||||
Reference in New Issue
Block a user