Skip to content

Commit

Permalink
bump sysinfo version
Browse files Browse the repository at this point in the history
  • Loading branch information
pietroalbini committed Jun 4, 2022
1 parent 836b2d2 commit 70cdd7e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MetricsState>,
Expand Down Expand Up @@ -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::<f32>();
let cpu = state.system_info.cpus().iter().map(|p| p.cpu_usage()).sum::<f32>();
step.cpu_usage_time_sec += cpu as f64 / 100.0 * elapsed.as_secs_f64();
}

Expand All @@ -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,
};
Expand Down

0 comments on commit 70cdd7e

Please sign in to comment.