|
|
@ -151,12 +151,12 @@ func (u *DashboardService) LoadCurrentInfo(ioOption string, netOption string) *d
|
|
|
|
currentInfo.Procs = hostInfo.Procs
|
|
|
|
currentInfo.Procs = hostInfo.Procs
|
|
|
|
|
|
|
|
|
|
|
|
currentInfo.CPUTotal, _ = cpu.Counts(true)
|
|
|
|
currentInfo.CPUTotal, _ = cpu.Counts(true)
|
|
|
|
totalPercent, _ := cpu.Percent(1*time.Second, false)
|
|
|
|
totalPercent, _ := cpu.Percent(100*time.Millisecond, false)
|
|
|
|
if len(totalPercent) == 1 {
|
|
|
|
if len(totalPercent) == 1 {
|
|
|
|
currentInfo.CPUUsedPercent = totalPercent[0]
|
|
|
|
currentInfo.CPUUsedPercent = totalPercent[0]
|
|
|
|
currentInfo.CPUUsed = currentInfo.CPUUsedPercent * 0.01 * float64(currentInfo.CPUTotal)
|
|
|
|
currentInfo.CPUUsed = currentInfo.CPUUsedPercent * 0.01 * float64(currentInfo.CPUTotal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
currentInfo.CPUPercent, _ = cpu.Percent(1*time.Second, true)
|
|
|
|
currentInfo.CPUPercent, _ = cpu.Percent(100*time.Millisecond, true)
|
|
|
|
|
|
|
|
|
|
|
|
loadInfo, _ := load.Avg()
|
|
|
|
loadInfo, _ := load.Avg()
|
|
|
|
currentInfo.Load1 = loadInfo.Load1
|
|
|
|
currentInfo.Load1 = loadInfo.Load1
|
|
|
|