From 790ac775d079d99183c596a233a7a141cbb92003 Mon Sep 17 00:00:00 2001 From: brianch Date: Wed, 31 Jan 2024 15:00:13 -0300 Subject: [PATCH] The memory information is returned in bytes and not kb. Fix the documentation of the Information struct, and the example system_information that uses it. Co-authored-by: =?UTF-8?q?Ahmet=20Kaan=20G=C3=9CM=C3=9C=C5=9E?= <96421894+Tahinli@users.noreply.github.com> --- examples/system_information/src/main.rs | 11 ++++++----- runtime/src/system/information.rs | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/system_information/src/main.rs b/examples/system_information/src/main.rs index 507431eed1..6df714d679 100644 --- a/examples/system_information/src/main.rs +++ b/examples/system_information/src/main.rs @@ -102,24 +102,25 @@ impl Application for Example { )); let memory_readable = - ByteSize::kb(information.memory_total).to_string(); + ByteSize::b(information.memory_total).to_string(); let memory_total = text(format!( - "Memory (total): {} kb ({memory_readable})", + "Memory (total): {} bytes ({memory_readable})", information.memory_total, )); let memory_text = if let Some(memory_used) = information.memory_used { - let memory_readable = ByteSize::kb(memory_used).to_string(); + let memory_readable = ByteSize::b(memory_used).to_string(); - format!("{memory_used} kb ({memory_readable})") + format!("{memory_used} bytes ({memory_readable})") } else { String::from("None") }; - let memory_used = text(format!("Memory (used): {memory_text}")); + let memory_used = + text(format!("Memory used by this process: {memory_text}")); let graphics_adapter = text(format!( "Graphics adapter: {}", diff --git a/runtime/src/system/information.rs b/runtime/src/system/information.rs index 93e7a5a46a..0f78f5e926 100644 --- a/runtime/src/system/information.rs +++ b/runtime/src/system/information.rs @@ -18,9 +18,9 @@ pub struct Information { pub cpu_brand: String, /// The number of physical cores on the processor pub cpu_cores: Option, - /// Total RAM size, KB + /// Total RAM size, in bytes pub memory_total: u64, - /// Memory used by this process, KB + /// Memory used by this process, in bytes pub memory_used: Option, /// Underlying graphics backend for rendering pub graphics_backend: String,