|
@@ -60,19 +60,19 @@ func GetTop10() []string {
|
|
|
return top10
|
|
|
}
|
|
|
|
|
|
-// GetCpuPercent cpu总占用率
|
|
|
+// cpu总占用率
|
|
|
func GetCpuPercent() float64 {
|
|
|
percent, _ := cpu.Percent(time.Second, false)
|
|
|
return percent[0]
|
|
|
}
|
|
|
|
|
|
-// GetMemoryPercent 内存总占用率
|
|
|
+// 内存总占用率
|
|
|
func GetMemoryPercent() float64 {
|
|
|
memory, _ := mem.SwapMemory()
|
|
|
return memory.UsedPercent
|
|
|
}
|
|
|
|
|
|
-// GetDiskPercent 磁盘总占用率
|
|
|
+// 磁盘总占用率
|
|
|
func GetDiskPercent() float64 {
|
|
|
parts, _ := disk.Partitions(true)
|
|
|
diskInfo, _ := disk.Usage(parts[0].Mountpoint)
|