package state

import (
	"be.ems/lib/log"
	"github.com/shirou/gopsutil/v4/cpu"
	"github.com/shirou/gopsutil/v4/mem"
)

func getCpuNumber() int {
	// 获取CPU信息
	cpuInfo, err := cpu.Info()
	if err != nil {
		log.Errorf("Failed to get CPU info: %v", err)
		return 0
	}
	log.Tracef("CPU info: %+v", cpuInfo)
	return len(cpuInfo)
}

func getTotalMemory() int {
	// 获取内存信息
	memInfo, err := mem.VirtualMemory()
	if err != nil {
		log.Errorf("Failed to get memory info: %v", err)
		return 0
	}
	log.Tracef("Memory info: %+v", memInfo)
	return int(memInfo.Total)
}
