From 80c6b5836176452afb107b288f01ed7370e79c6f Mon Sep 17 00:00:00 2001 From: Trey t Date: Tue, 9 Dec 2025 10:57:51 -0600 Subject: [PATCH] Increase CPU sampling interval for accurate readings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed from 100ms to 1 second sampling interval in gopsutil cpu.Percent() call. Shorter intervals can give inaccurate readings due to timing issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- internal/monitoring/collector.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/monitoring/collector.go b/internal/monitoring/collector.go index 9b7ef9e..bf2e70d 100644 --- a/internal/monitoring/collector.go +++ b/internal/monitoring/collector.go @@ -77,8 +77,9 @@ func (c *Collector) Collect() SystemStats { } func (c *Collector) collectCPU(stats *SystemStats) { - // Get CPU usage percentage (this blocks for ~100ms to sample) - if cpuPercent, err := cpu.Percent(100*time.Millisecond, false); err == nil && len(cpuPercent) > 0 { + // Get CPU usage percentage (blocks for 1 second to get accurate sample) + // Shorter intervals can give inaccurate readings + if cpuPercent, err := cpu.Percent(time.Second, false); err == nil && len(cpuPercent) > 0 { stats.CPU.UsagePercent = cpuPercent[0] }