From f2bd9947cccd36b6fe2c6539dac2ede3f95b4ad6 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Mon, 15 Nov 2021 14:42:41 -0600 Subject: [PATCH] mem stats: rescale from kb to bytes (#21282) --- core/src/system_monitor_service.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/system_monitor_service.rs b/core/src/system_monitor_service.rs index 07bea88a5..f3906e146 100644 --- a/core/src/system_monitor_service.rs +++ b/core/src/system_monitor_service.rs @@ -186,16 +186,22 @@ impl SystemMonitorService { fn report_mem_stats() { if let Ok(info) = sys_info::mem_info() { + // stats are returned in kb. + const KB: u64 = 1_024; datapoint_info!( "memory-stats", - ("total", info.total, i64), + ("total", info.total * KB, i64), ("swap_total", info.swap_total, i64), ( "free_percent", Self::calc_percent(info.free, info.total), f64 ), - ("used_bytes", info.total.saturating_sub(info.avail), i64), + ( + "used_bytes", + info.total.saturating_sub(info.avail) * KB, + i64 + ), ( "avail_percent", Self::calc_percent(info.avail, info.total),