diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app/data_harvester/processes/macos_freebsd.rs | 9 | ||||
-rw-r--r-- | src/app/data_harvester/processes/windows.rs | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/app/data_harvester/processes/macos_freebsd.rs b/src/app/data_harvester/processes/macos_freebsd.rs index 588d49dc..a4ac1e2d 100644 --- a/src/app/data_harvester/processes/macos_freebsd.rs +++ b/src/app/data_harvester/processes/macos_freebsd.rs @@ -50,11 +50,12 @@ where }; let pcu = { - let p = process_val.cpu_usage() as f64 / num_processors; - if p.is_nan() { - process_val.cpu_usage() as f64 + let usage = process_val.cpu_usage() as f64; + let res = usage / num_processors; + if res.is_finite() { + res } else { - p + usage } }; let process_cpu_usage = if use_current_cpu_total && cpu_usage > 0.0 { diff --git a/src/app/data_harvester/processes/windows.rs b/src/app/data_harvester/processes/windows.rs index 7eac0411..55b59086 100644 --- a/src/app/data_harvester/processes/windows.rs +++ b/src/app/data_harvester/processes/windows.rs @@ -42,11 +42,12 @@ pub fn get_process_data( }; let pcu = { - let p = process_val.cpu_usage() as f64 / num_processors; - if p.is_nan() { - process_val.cpu_usage() as f64 + let usage = process_val.cpu_usage() as f64; + let res = usage / num_processors; + if res.is_finite() { + res } else { - p + usage } }; let process_cpu_usage = if use_current_cpu_total && cpu_usage > 0.0 { |