From 1635b9948697de15ce5f65c8d4e4cd5d0201e7e2 Mon Sep 17 00:00:00 2001 From: Haoran Yi Date: Mon, 28 Nov 2022 17:47:47 -0600 Subject: [PATCH] add mmmap file count --- core/src/system_monitor_service.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/system_monitor_service.rs b/core/src/system_monitor_service.rs index 9911597dc..a73952165 100644 --- a/core/src/system_monitor_service.rs +++ b/core/src/system_monitor_service.rs @@ -839,6 +839,7 @@ impl SystemMonitorService { fn get_open_fd_stats() -> Option<(usize, usize, usize)> { let proc = Process::myself().ok()?; let curr_num_open_fd = proc.fd_count().unwrap(); + let curr_mmap_count = proc.maps().unwrap().len(); let max_open_fd_limit = proc.limits().unwrap().max_open_files; let max_open_fd_soft_limit = match max_open_fd_limit.soft_limit { @@ -852,18 +853,24 @@ impl SystemMonitorService { Some(( curr_num_open_fd, + curr_mmap_count, max_open_fd_soft_limit, max_open_fd_hard_limit, )) } fn report_open_fd_stats() { - if let Some((curr_num_open_fd, max_open_fd_soft_limit, max_open_fd_hard_limit)) = - Self::get_open_fd_stats() + if let Some(( + curr_num_open_fd, + curr_mmap_count, + max_open_fd_soft_limit, + max_open_fd_hard_limit, + )) = Self::get_open_fd_stats() { datapoint_info!( "open-fd-stats", ("number_open_files", curr_num_open_fd, i64), + ("number_mmap_files", curr_mmap_count, i64), ("max_open_files_hard_limit", max_open_fd_hard_limit, i64), ("max_open_files_soft_limit", max_open_fd_soft_limit, i64), );