| 1 | //! Unix-specific parts of process collection. |
| 2 | |
| 3 | mod user_table; |
| 4 | |
| 5 | pub use user_table::*; |
| 6 | |
| 7 | cfg_select! { |
| 8 | all(target_family = "unix", not(target_os = "linux")) => { |
| 9 | mod process_ext; |
| 10 | pub(crate) use process_ext::*; |
| 11 | |
| 12 | use super::ProcessHarvest; |
| 13 | |
| 14 | use crate::collection::{DataCollector, processes::*}; |
| 15 | use crate::collection::error::CollectionResult; |
| 16 | |
| 17 | pub fn sysinfo_process_data(collector: &mut DataCollector) -> CollectionResult<Vec<ProcessHarvest>> { |
| 18 | let sys = &collector.sys.system; |
| 19 | let use_current_cpu_total = collector.use_current_cpu_total; |
| 20 | let unnormalized_cpu = collector.unnormalized_cpu; |
| 21 | let total_memory = collector.total_memory(); |
| 22 | let user_table = &mut collector.user_table; |
| 23 | |
| 24 | cfg_select! { |
| 25 | target_os = "macos" => { |
| 26 | MacOSProcessExt::sysinfo_process_data(sys, use_current_cpu_total, unnormalized_cpu, total_memory, user_table) |
| 27 | } |
| 28 | target_os = "freebsd" => { |
| 29 | FreeBSDProcessExt::sysinfo_process_data(sys, use_current_cpu_total, unnormalized_cpu, total_memory, user_table) |
| 30 | } |
| 31 | _ => { |
| 32 | GenericProcessExt::sysinfo_process_data(sys, use_current_cpu_total, unnormalized_cpu, total_memory, user_table) |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | } |
| 38 | _ => {} |
| 39 | } |