diff options
| author | Fuwn <[email protected]> | 2021-07-01 01:17:21 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-07-01 01:17:21 +0000 |
| commit | 34c4160f9c1b773f3625b65b9f76f3a365639ead (patch) | |
| tree | 04c2cb057a8afcbc790336c9d71b1b4a97186fa7 | |
| parent | fix(deps): update rust crate sysinfo to 0.19.0 (diff) | |
| download | whirl-34c4160f9c1b773f3625b65b9f76f3a365639ead.tar.xz whirl-34c4160f9c1b773f3625b65b9f76f3a365639ead.zip | |
fix(whirl_api): update sysinfo method calls for `0.19.0`
| -rw-r--r-- | crates/whirl_api/src/routes/stats/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/whirl_api/src/routes/stats/mod.rs b/crates/whirl_api/src/routes/stats/mod.rs index ed45d0d..c0f8f72 100644 --- a/crates/whirl_api/src/routes/stats/mod.rs +++ b/crates/whirl_api/src/routes/stats/mod.rs @@ -17,20 +17,20 @@ pub fn statistics() -> HttpResponse { let mut sys = System::new_all(); sys.refresh_all(); - let process = sys.get_process(get_current_pid().unwrap()).unwrap(); + let process = sys.process(get_current_pid().unwrap()).unwrap(); HttpResponse::Ok().json(Statistics { system: StatisticsSystem { - os_type: sys.get_name().unwrap(), - release: sys.get_kernel_version().unwrap(), + os_type: sys.name().unwrap(), + release: sys.kernel_version().unwrap(), uptime: whirl_common::system::seconds_to_hrtime( - usize::try_from(sysinfo::System::new().get_uptime()).unwrap(), + usize::try_from(sysinfo::System::new().uptime()).unwrap(), ), }, process: StatisticsProcess { // (process.cpu_usage() * 100.0).round() / 100.0 memory_usage: (process.memory() / 1000).to_string(), - cpu_usage: (process.cpu_usage() / sys.get_processors().len().as_(): f32).to_string(), + cpu_usage: (process.cpu_usage() / sys.processors().len().as_(): f32).to_string(), // uptime: seconds_to_hrtime((sys.get_uptime() - process.start_time()) as usize), }, }) |