Track shared memory in metrics (#5023)

* Track shared memory so we can exclude them form resident memory.

* Bump psutil version to 3.3.0 to get shared memory metrics.
This commit is contained in:
Jimmy Chen
2024-01-06 06:48:11 +11:00
committed by GitHub
parent 01994c438e
commit 0c97762032
4 changed files with 18 additions and 32 deletions

View File

@@ -243,6 +243,8 @@ pub struct ProcessHealth {
pub pid_mem_resident_set_size: u64,
/// The total virtual memory used by this pid.
pub pid_mem_virtual_memory_size: u64,
/// The total shared memory used by this pid.
pub pid_mem_shared_memory_size: u64,
/// Number of cpu seconds consumed by this pid.
pub pid_process_seconds_total: u64,
}
@@ -277,6 +279,7 @@ impl ProcessHealth {
pid_num_threads: stat.num_threads,
pid_mem_resident_set_size: process_mem.rss(),
pid_mem_virtual_memory_size: process_mem.vms(),
pid_mem_shared_memory_size: process_mem.shared(),
pid_process_seconds_total: process_times.busy().as_secs()
+ process_times.children_system().as_secs()
+ process_times.children_system().as_secs(),