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] }