mem stats: rescale from kb to bytes (#21282)
This commit is contained in:
parent
d8a392c20b
commit
f2bd9947cc
|
@ -186,16 +186,22 @@ impl SystemMonitorService {
|
||||||
|
|
||||||
fn report_mem_stats() {
|
fn report_mem_stats() {
|
||||||
if let Ok(info) = sys_info::mem_info() {
|
if let Ok(info) = sys_info::mem_info() {
|
||||||
|
// stats are returned in kb.
|
||||||
|
const KB: u64 = 1_024;
|
||||||
datapoint_info!(
|
datapoint_info!(
|
||||||
"memory-stats",
|
"memory-stats",
|
||||||
("total", info.total, i64),
|
("total", info.total * KB, i64),
|
||||||
("swap_total", info.swap_total, i64),
|
("swap_total", info.swap_total, i64),
|
||||||
(
|
(
|
||||||
"free_percent",
|
"free_percent",
|
||||||
Self::calc_percent(info.free, info.total),
|
Self::calc_percent(info.free, info.total),
|
||||||
f64
|
f64
|
||||||
),
|
),
|
||||||
("used_bytes", info.total.saturating_sub(info.avail), i64),
|
(
|
||||||
|
"used_bytes",
|
||||||
|
info.total.saturating_sub(info.avail) * KB,
|
||||||
|
i64
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"avail_percent",
|
"avail_percent",
|
||||||
Self::calc_percent(info.avail, info.total),
|
Self::calc_percent(info.avail, info.total),
|
||||||
|
|
Loading…
Reference in New Issue