CPU widget code cleanup

This commit is contained in:
Caleb Bassi 2018-04-10 21:03:13 -07:00
parent 9f22c32c71
commit 08e981218d
1 changed files with 2 additions and 1 deletions

View File

@ -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 {