diff --git a/Cargo.lock b/Cargo.lock index 6c46be14e4e..17c75deb2b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5060,9 +5060,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.23.11" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf915673a340ee41f2fc24ad1286c75ea92026f04b65a0d0e5132d80b95fc61" +checksum = "a6a8e71535da31837213ac114531d31def75d7aebd133264e420a3451fa7f703" dependencies = [ "cfg-if 1.0.0", "core-foundation-sys", diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index d4c6f927df0..5027a45e0ad 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -50,7 +50,7 @@ once_cell = "1.7.2" xz2 = "0.1" # Dependencies needed by the build-metrics feature -sysinfo = { version = "0.23.0", optional = true } +sysinfo = { version = "0.24.1", optional = true } [target.'cfg(windows)'.dependencies.winapi] version = "0.3" diff --git a/src/bootstrap/metrics.rs b/src/bootstrap/metrics.rs index 56a79e99b7c..451febddc88 100644 --- a/src/bootstrap/metrics.rs +++ b/src/bootstrap/metrics.rs @@ -12,7 +12,7 @@ use std::cell::RefCell; use std::fs::File; use std::io::BufWriter; use std::time::{Duration, Instant}; -use sysinfo::{ProcessorExt, System, SystemExt}; +use sysinfo::{CpuExt, System, SystemExt}; pub(crate) struct BuildMetrics { state: RefCell, @@ -79,7 +79,7 @@ impl BuildMetrics { step.duration_excluding_children_sec += elapsed; state.system_info.refresh_cpu(); - let cpu = state.system_info.processors().iter().map(|p| p.cpu_usage()).sum::(); + let cpu = state.system_info.cpus().iter().map(|p| p.cpu_usage()).sum::(); step.cpu_usage_time_sec += cpu as f64 / 100.0 * elapsed.as_secs_f64(); } @@ -94,8 +94,8 @@ impl BuildMetrics { system.refresh_memory(); let system_stats = JsonInvocationSystemStats { - cpu_threads_count: system.processors().len(), - cpu_model: system.processors()[0].brand().into(), + cpu_threads_count: system.cpus().len(), + cpu_model: system.cpus()[0].brand().into(), memory_total_bytes: system.total_memory() * 1024, };