diff options
| author | Fuwn <[email protected]> | 2024-06-03 15:23:14 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-06-03 15:23:14 -0700 |
| commit | 19010055c88fd7aac23f3ce39fa6a5ec1cbf9a52 (patch) | |
| tree | 22353b8c7a78b83c992b7bfb60c024fee6f78e3e /crates/whirl_api/src/routes/stats | |
| parent | chore(rustfmt): add new rules (diff) | |
| download | whirl-19010055c88fd7aac23f3ce39fa6a5ec1cbf9a52.tar.xz whirl-19010055c88fd7aac23f3ce39fa6a5ec1cbf9a52.zip | |
format: rustfmt with new rules
Diffstat (limited to 'crates/whirl_api/src/routes/stats')
| -rw-r--r-- | crates/whirl_api/src/routes/stats/mod.rs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/crates/whirl_api/src/routes/stats/mod.rs b/crates/whirl_api/src/routes/stats/mod.rs index 05b9bc7..0898902 100644 --- a/crates/whirl_api/src/routes/stats/mod.rs +++ b/crates/whirl_api/src/routes/stats/mod.rs @@ -3,12 +3,14 @@ pub mod structures; -use std::convert::TryFrom; - -use axum::response; -use sysinfo::{get_current_pid, ProcessExt, System, SystemExt}; - -use crate::routes::stats::structures::{Statistics, StatisticsProcess, StatisticsSystem}; +use { + crate::routes::stats::structures::{ + Statistics, StatisticsProcess, StatisticsSystem, + }, + axum::response, + std::convert::TryFrom, + sysinfo::{get_current_pid, ProcessExt, System, SystemExt}, +}; // This is mostly for developmental testing, it consumes more CPU than it's // worth. @@ -25,13 +27,17 @@ pub async fn statistics() -> impl response::IntoResponse { system: StatisticsSystem { os_type: sys.name().unwrap(), release: sys.kernel_version().unwrap(), - uptime: whirl_common::system::unixts_to_hrtime(usize::try_from(sys.uptime()).unwrap()), + uptime: whirl_common::system::unixts_to_hrtime( + usize::try_from(sys.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.processors().len() as f32).to_string(), - // uptime: seconds_to_hrtime((sys.get_uptime() - process.start_time()) as usize), + cpu_usage: (process.cpu_usage() / sys.processors().len() as f32) + .to_string(), + // uptime: seconds_to_hrtime((sys.get_uptime() - process.start_time()) + // as usize), }, }), ) |