docker stats nightmare
All checks were successful
Rust Cross-Platform Build / Detect Rust Project (push) Successful in 5s
Rust Cross-Platform Build / Run Tests (push) Successful in 1m17s
Rust Cross-Platform Build / Build (x86_64-unknown-linux-gnu) (push) Successful in 3m30s
Rust Cross-Platform Build / Build (x86_64-pc-windows-gnu) (push) Successful in 4m22s
Rust Cross-Platform Build / Set Tag Name (push) Successful in 4s
Rust Cross-Platform Build / Build and Push Docker Image (push) Successful in 2m24s
Rust Cross-Platform Build / Workflow Summary (push) Successful in 2s
Rust Cross-Platform Build / Create Tag (push) Successful in 5s
All checks were successful
Rust Cross-Platform Build / Detect Rust Project (push) Successful in 5s
Rust Cross-Platform Build / Run Tests (push) Successful in 1m17s
Rust Cross-Platform Build / Build (x86_64-unknown-linux-gnu) (push) Successful in 3m30s
Rust Cross-Platform Build / Build (x86_64-pc-windows-gnu) (push) Successful in 4m22s
Rust Cross-Platform Build / Set Tag Name (push) Successful in 4s
Rust Cross-Platform Build / Build and Push Docker Image (push) Successful in 2m24s
Rust Cross-Platform Build / Workflow Summary (push) Successful in 2s
Rust Cross-Platform Build / Create Tag (push) Successful in 5s
This commit is contained in:
@@ -51,19 +51,19 @@ pub async fn get_single_container_cpu_stats(
|
||||
if let (Some(cpu_usage), Some(pre_cpu_usage)) =
|
||||
(&cpu_stats.cpu_usage, &precpu_stats.cpu_usage)
|
||||
{
|
||||
let cpu_delta = cpu_usage
|
||||
let cpu_delta: f64 = cpu_usage
|
||||
.total_usage
|
||||
.unwrap_or(0)
|
||||
.saturating_sub(pre_cpu_usage.total_usage.unwrap_or(0));
|
||||
.saturating_sub(pre_cpu_usage.total_usage.unwrap_or(0)) as f64;
|
||||
|
||||
let system_delta = cpu_stats
|
||||
let system_delta: f64 = cpu_stats
|
||||
.system_cpu_usage
|
||||
.unwrap_or(0)
|
||||
.saturating_sub(precpu_stats.system_cpu_usage.unwrap_or(0));
|
||||
.saturating_sub(precpu_stats.system_cpu_usage.unwrap_or(0)) as f64;
|
||||
|
||||
let online_cpus = cpu_stats.online_cpus.unwrap_or(1);
|
||||
|
||||
let cpu_percent = if system_delta > 0 && online_cpus > 0 {
|
||||
let cpu_percent = if system_delta > 0.0 && online_cpus > 0 {
|
||||
(cpu_delta as f64 / system_delta as f64) * online_cpus as f64 * 100.0
|
||||
} else {
|
||||
0.0
|
||||
|
||||
Reference in New Issue
Block a user