From 863f216eeec82b1e3a7e57ab27f3fdfe6abb701e Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 9 Oct 2026 19:18:55 +0200 Subject: [PATCH] gate cgroup cpu stat parsers to non-windows builds (#11652) Co-authored-by: Claude Opus 5.5 --- backend/windmill-common/src/worker.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/windmill-common/src/worker.rs b/backend/windmill-common/src/worker.rs index 017c244670..9bc788d9f3 100644 --- a/backend/windmill-common/src/worker.rs +++ b/backend/windmill-common/src/worker.rs @@ -1805,6 +1805,7 @@ pub struct CpuStat { pub throttled_usec: u64, } +#[cfg(not(windows))] fn cpu_stat_field(stat: &str, key: &str) -> Option { stat.lines().find_map(|line| { let (k, v) = line.split_once(' ')?; @@ -1812,6 +1813,7 @@ fn cpu_stat_field(stat: &str, key: &str) -> Option { }) } +#[cfg(not(windows))] fn parse_cgroup_v2_cpu_stat(stat: &str) -> Option { Some(CpuStat { usage_usec: cpu_stat_field(stat, "usage_usec")?, @@ -1822,6 +1824,7 @@ fn parse_cgroup_v2_cpu_stat(stat: &str) -> Option { } /// cgroup v1 splits the same figures over two controllers and counts time in nanoseconds. +#[cfg(not(windows))] fn parse_cgroup_v1_cpu_stat(cpuacct_usage: &str, stat: &str) -> Option { Some(CpuStat { usage_usec: cpuacct_usage.trim().parse::().ok()? / 1000, @@ -2986,6 +2989,7 @@ mod tests { use super::*; use std::collections::HashMap; + #[cfg(not(windows))] #[test] fn cgroup_cpu_stat_is_normalized_to_microseconds() { let v2 = "usage_usec 2500000\nuser_usec 2000000\nsystem_usec 500000\n\