Files
EdgeAPI/internal/nodes/node_status_executor_test.go
GoEdgeLab 5a17ae9d79 v1.4.1
2024-07-27 14:15:25 +08:00

29 lines
485 B
Go

package nodes
import (
"testing"
"time"
"github.com/shirou/gopsutil/v3/cpu"
)
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)
}