From 08e981218d8efd83d515ba482e6b2e7934b84f46 Mon Sep 17 00:00:00 2001 From: Caleb Bassi Date: Tue, 10 Apr 2018 21:03:13 -0700 Subject: CPU widget code cleanup --- widgets/cpu.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/widgets/cpu.go b/widgets/cpu.go index 4e226c0..b84af2c 100644 --- a/widgets/cpu.go +++ b/widgets/cpu.go @@ -45,8 +45,9 @@ func NewCPU(interval time.Duration, zoom int) *CPU { return self } +// calculates the CPU usage over a 1 second interval and blocks for the duration func (self *CPU) update() { - // psutil calculates the CPU usage over a 1 second interval, therefore it blocks for 1 second + // show average cpu usage if more than 8 cores if self.Count <= 8 { percents, _ := psCPU.Percent(self.interval, true) if len(percents) != self.Count { -- cgit v1.2.3