diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2023-03-26 01:53:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-26 01:53:43 -0400 |
commit | 7ee6da37766fdb2e36d9e9e11668f3fafe35463e (patch) | |
tree | 7f0427e0235823bdb471f84a95094092a7c4c442 /src/app/data_harvester/processes/windows.rs | |
parent | 358db119bb927fec7c3699f7fed79873958aaf29 (diff) |
refactor: unify on using bytes for the memory unit when harvesting (#1077)
* refactor: unify on using bytes for the memory unit when harvesting
* some ordering stuff that doesn't mean much
* some comments
* more fixes
* refactor: rename
* comments v2
* some more cleanup
* remove uninlined_format_args allow
Diffstat (limited to 'src/app/data_harvester/processes/windows.rs')
-rw-r--r-- | src/app/data_harvester/processes/windows.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/app/data_harvester/processes/windows.rs b/src/app/data_harvester/processes/windows.rs index cbdcea5c..78f4d107 100644 --- a/src/app/data_harvester/processes/windows.rs +++ b/src/app/data_harvester/processes/windows.rs @@ -5,7 +5,7 @@ use sysinfo::{CpuExt, PidExt, ProcessExt, System, SystemExt, UserExt}; use super::ProcessHarvest; pub fn get_process_data( - sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, mem_total: u64, + sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, total_memory: u64, ) -> crate::utils::error::Result<Vec<ProcessHarvest>> { let mut process_vector: Vec<ProcessHarvest> = Vec::new(); let process_hashmap = sys.processes(); @@ -63,8 +63,8 @@ pub fn get_process_data( parent_pid: process_val.parent().map(|p| p.as_u32() as _), name, command, - mem_usage_percent: if mem_total > 0 { - process_val.memory() as f64 * 100.0 / mem_total as f64 + mem_usage_percent: if total_memory > 0 { + process_val.memory() as f64 * 100.0 / total_memory as f64 } else { 0.0 }, |