[API节点]列表显示版本号、CPU、内存、状态等信息

This commit is contained in:
GoEdgeLab
2020-12-29 18:28:07 +08:00
parent fe1e99bacc
commit f1f321a5c3
14 changed files with 504 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
package nodes
import (
"github.com/shirou/gopsutil/cpu"
"testing"
"time"
)
func TestNodeStatusExecutor_CPU(t *testing.T) {
countLogicCPU, err := cpu.Counts(true)
if err != nil {
t.Fatal(err)
}
t.Log("logic count:", countLogicCPU)
countPhysicalCPU, err := cpu.Counts(false)
if err != nil {
t.Fatal(err)
}
t.Log("physical count:", countPhysicalCPU)
percents, err := cpu.Percent(100 * time.Millisecond, false)
if err != nil {
t.Fatal(err)
}
t.Log(percents)
}