mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-29 18:27:58 +08:00
Merge branch 'V3.7' of https://github.com/goodrain/rainbond into V3.7
This commit is contained in:
commit
6d225dc897
@ -153,6 +153,7 @@ type NodeSystemInfo struct {
|
||||
Architecture string `json:"architecture"`
|
||||
|
||||
MemorySize uint64 `json:"memorySize"`
|
||||
NumCPU int64 `json:"cpu_num"`
|
||||
}
|
||||
|
||||
//Decode decode node info
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user