Skip to content

Commit

Permalink
Add more checks on host_processor_info
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 30, 2024
1 parent 43a1246 commit cb5121c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/unix/apple/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,14 @@ pub(crate) fn update_cpu_usage<F: FnOnce(Arc<CpuData>, *mut i32) -> (f32, usize)
&mut cpu_info as *mut *mut i32,
&mut num_cpu_info as *mut u32,
) == libc::KERN_SUCCESS
&& cpu_count > 0

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check nightly / x86_64-apple-darwin

cannot find value `cpu_count` in this scope

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check stable / x86_64-apple-darwin

cannot find value `cpu_count` in this scope

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check nightly / aarch64-apple-ios

cannot find value `cpu_count` in this scope

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check stable / x86_64-apple-ios

cannot find value `cpu_count` in this scope

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check stable / aarch64-apple-ios

cannot find value `cpu_count` in this scope

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check nightly / x86_64-apple-ios

cannot find value `cpu_count` in this scope

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check 1.69.0 / aarch64-apple-ios

cannot find value `cpu_count` in this scope

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check 1.69.0 / x86_64-apple-ios

cannot find value `cpu_count` in this scope

Check failure on line 266 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check 1.69.0 / x86_64-apple-darwin

cannot find value `cpu_count` in this scope
&& !cpu_load.is_null()

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check nightly / x86_64-apple-darwin

cannot find value `cpu_load` in this scope

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check stable / x86_64-apple-darwin

cannot find value `cpu_load` in this scope

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check nightly / aarch64-apple-ios

cannot find value `cpu_load` in this scope

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check stable / x86_64-apple-ios

cannot find value `cpu_load` in this scope

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check stable / aarch64-apple-ios

cannot find value `cpu_load` in this scope

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check nightly / x86_64-apple-ios

cannot find value `cpu_load` in this scope

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check 1.69.0 / aarch64-apple-ios

cannot find value `cpu_load` in this scope

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check 1.69.0 / x86_64-apple-ios

cannot find value `cpu_load` in this scope

Check failure on line 267 in src/unix/apple/cpu.rs

View workflow job for this annotation

GitHub Actions / Check 1.69.0 / x86_64-apple-darwin

cannot find value `cpu_load` in this scope
{
let (total_percentage, len) =
f(Arc::new(CpuData::new(cpu_info, num_cpu_info)), cpu_info);
total_cpu_usage = total_percentage / len as f32;
} else {
sysinfo_debug!("host_processor_info failed, not updating CPU ticks usage...");
}
global_cpu.inner.set_cpu_usage(total_cpu_usage);
}
Expand Down

0 comments on commit cb5121c

Please sign in to comment.