diff --git a/node/nodem/client/node.go b/node/nodem/client/node.go index 19b32c725..3d8ffd4fe 100644 --- a/node/nodem/client/node.go +++ b/node/nodem/client/node.go @@ -153,6 +153,7 @@ type NodeSystemInfo struct { Architecture string `json:"architecture"` MemorySize uint64 `json:"memorySize"` + NumCPU int64 `json:"cpu_num"` } //Decode decode node info diff --git a/node/nodem/info/info_linux.go b/node/nodem/info/info_linux.go index 03f6fd684..b9d96bfce 100644 --- a/node/nodem/info/info_linux.go +++ b/node/nodem/info/info_linux.go @@ -45,6 +45,7 @@ func GetSystemInfo() (info client.NodeSystemInfo) { } info.OperatingSystem = runtime.GOOS info.MemorySize, _ = getMemory() + info.NumCPU = int64(runtime.NumCPU()) return info } @@ -72,7 +73,7 @@ func getMemory() (total uint64, free uint64) { sysInfo := new(syscall.Sysinfo_t) err := syscall.Sysinfo(sysInfo) if err == nil { - return sysInfo.Totalram * uint64(syscall.Getpagesize()), sysInfo.Freeram * uint64(syscall.Getpagesize()) + return uint64(sysInfo.Totalram) * uint64(sysInfo.Unit), sysInfo.Freeram * uint64(syscall.Getpagesize()) } return 0, 0 }