Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
update sysinfo to 0.20.0 (#1145)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmc-msft authored Aug 12, 2021
1 parent 332dfd9 commit 92ce90a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/agent/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/agent/onefuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ serde = "1.0"
serde_json = "1.0"
rand = "0.8"
serde_derive = "1.0"
sysinfo = "0.18"
sysinfo = "0.20"
tokio = { version = "1.8", features = ["full"] }
tokio-stream = { version = "0.1", features = ["fs", "time", "tokio-util"] }
tokio-util = { version = "0.6", features = ["full"] }
Expand Down
22 changes: 11 additions & 11 deletions src/agent/onefuzz/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ impl System {
pub fn system_info(&self) -> SystemInfo {
let system = &self.system;

let total_memory_kib = system.get_total_memory();
let used_memory_kib = system.get_used_memory();
let free_memory_kib = system.get_free_memory();
let total_swap_kib = system.get_total_swap();
let used_swap_kib = system.get_used_swap();
let uptime = system.get_uptime();

let load_avg = system.get_load_average();
let total_memory_kib = system.total_memory();
let used_memory_kib = system.used_memory();
let free_memory_kib = system.free_memory();
let total_swap_kib = system.total_swap();
let used_swap_kib = system.used_swap();
let uptime = system.uptime();

let load_avg = system.load_average();
let load_avg_1min = load_avg.one;
let load_avg_5min = load_avg.five;
let load_avg_15min = load_avg.fifteen;

let global_cpu = system.get_global_processor_info();
let cpu_usage = global_cpu.get_cpu_usage();
let global_cpu = system.global_processor_info();
let cpu_usage = global_cpu.cpu_usage();

SystemInfo {
total_memory_kib,
Expand All @@ -99,7 +99,7 @@ impl System {

pub fn proc_info(&self, pid: u32) -> Option<ProcInfo> {
let system = &self.system;
let pi = system.get_process(pid as Pid)?;
let pi = system.process(pid as Pid)?;

let name = pi.name().into();
let status = format!("{}", pi.status());
Expand Down

0 comments on commit 92ce90a

Please sign in to comment.