Preserve old CPU widget behavior

This commit is contained in:
Ivan Trubach 2018-08-01 00:40:51 +03:00
parent 12527db13f
commit 813c239f7e
No known key found for this signature in database
GPG Key ID: FC2AF342E98E6BA2
2 changed files with 10 additions and 2 deletions

View File

@ -37,8 +37,8 @@ var (
zoom = 7
zoomInterval = 3
averageLoad = true
percpuLoad = true
averageLoad = false
percpuLoad = false
cpu *w.CPU
mem *w.Mem

View File

@ -28,6 +28,14 @@ func NewCPU(interval time.Duration, zoom int, average bool, percpu bool) *CPU {
self.Label = "CPU Usage"
self.Zoom = zoom
if !(self.Average || self.PerCPU) {
if self.Count <= 8 {
self.PerCPU = true
} else {
self.Average = true
}
}
if self.Average {
self.Data["Average"] = []float64{0}
}