diff options
Diffstat (limited to 'src/app/data_harvester/processes/windows.rs')
-rw-r--r-- | src/app/data_harvester/processes/windows.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/app/data_harvester/processes/windows.rs b/src/app/data_harvester/processes/windows.rs index 57af8b2c..3e30e52e 100644 --- a/src/app/data_harvester/processes/windows.rs +++ b/src/app/data_harvester/processes/windows.rs @@ -1,14 +1,21 @@ -//! Process data collection for Windows. Uses sysinfo. +//! Process data collection for Windows. Uses sysinfo. use std::time::Duration; -use sysinfo::{CpuExt, PidExt, ProcessExt, System, SystemExt, UserExt}; +use sysinfo::{CpuExt, PidExt, ProcessExt, SystemExt, UserExt}; use super::ProcessHarvest; -pub fn get_process_data( - sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, total_memory: u64, +use crate::data_harvester::DataCollector; + +pub fn sysinfo_process_data( + collector: &mut DataCollector, ) -> crate::utils::error::Result<Vec<ProcessHarvest>> { + let sys = &collector.sys; + let use_current_cpu_total = collector.use_current_cpu_total; + let unnormalized_cpu = collector.unnormalized_cpu; + let total_memory = collector.total_memory(); + let mut process_vector: Vec<ProcessHarvest> = Vec::new(); let process_hashmap = sys.processes(); let cpu_usage = sys.global_cpu_info().cpu_usage() as f64 / 100.0; |