mirror of https://github.com/cjbassi/gotop.git
Preserve old CPU widget behavior
This commit is contained in:
parent
12527db13f
commit
813c239f7e
4
main.go
4
main.go
|
@ -37,8 +37,8 @@ var (
|
|||
zoom = 7
|
||||
zoomInterval = 3
|
||||
|
||||
averageLoad = true
|
||||
percpuLoad = true
|
||||
averageLoad = false
|
||||
percpuLoad = false
|
||||
|
||||
cpu *w.CPU
|
||||
mem *w.Mem
|
||||
|
|
|
@ -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}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue