Files
EdgeNode/internal/nodes/node_status_executor_test.go

29 lines
483 B
Go
Raw Normal View History

2020-10-02 17:22:38 +08:00
package nodes
import (
"testing"
"time"
2024-07-27 15:42:50 +08:00
"github.com/shirou/gopsutil/v3/cpu"
2020-10-02 17:22:38 +08:00
)
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)
2021-01-25 19:40:57 +08:00
percents, err := cpu.Percent(100*time.Millisecond, false)
2020-10-02 17:22:38 +08:00
if err != nil {
t.Fatal(err)
}
t.Log(percents)
}