diff options
author | Caleb Bassi <calebjbassi@gmail.com> | 2018-04-10 21:03:13 -0700 |
---|---|---|
committer | Caleb Bassi <calebjbassi@gmail.com> | 2018-04-10 21:03:13 -0700 |
commit | 08e981218d8efd83d515ba482e6b2e7934b84f46 (patch) | |
tree | 6d7801c719aae37a13a7aa730c76fd183e49dd72 | |
parent | 9f22c32c718b1e65c6e999045d24313289c955b5 (diff) |
CPU widget code cleanup
-rw-r--r-- | widgets/cpu.go | 3 |
1 files changed, 2 insertions, 1 deletions
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 { |