From 695b12fd6cf8c56acc713a89eaf5edcde7094435 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Mon, 2 Sep 2024 20:18:28 +0200 Subject: [PATCH] Fix/simplify jemalloc metrics (#23) --- crates/alloc/src/stats.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/alloc/src/stats.rs b/crates/alloc/src/stats.rs index 4710c68..a502e2d 100644 --- a/crates/alloc/src/stats.rs +++ b/crates/alloc/src/stats.rs @@ -137,6 +137,11 @@ pub fn update_jemalloc_metrics() -> Result<(), Error> { // Cumulative number of allocation requests satisfied by bin regions of the // corresponding size class. gauge("jemalloc_memory_bin_nrequests", bin_stats.nrequests); + + let active = bin_stats.nmalloc - bin_stats.ndalloc; + + gauge("jemalloc_memory_bin_nactive", active); + gauge("jemalloc_memory_bin_nactive_size", active * bin_const.size); } Ok(())