mirror of
https://github.com/oneclickvirt/basics.git
synced 2025-10-06 00:57:35 +08:00
update
This commit is contained in:
@@ -3,5 +3,5 @@ package main
|
|||||||
import "github.com/oneclickvirt/basics/system"
|
import "github.com/oneclickvirt/basics/system"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
system.GetSystemInfo()
|
system.CheckSystemInfo()
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ package system
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/oneclickvirt/basics/system/model"
|
"github.com/oneclickvirt/basics/system/model"
|
||||||
@@ -16,8 +17,8 @@ var (
|
|||||||
cpuType string
|
cpuType string
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetHost 获取主机硬件信息
|
// GetSystemInfo 获取主机硬件信息
|
||||||
func GetHost() *model.SystemInfo {
|
func GetSystemInfo() *model.SystemInfo {
|
||||||
var ret = &model.SystemInfo{}
|
var ret = &model.SystemInfo{}
|
||||||
// 系统信息查询
|
// 系统信息查询
|
||||||
cpuType, ret.Uptime, ret.Platform, ret.Kernel, ret.Arch, ret.VmType, ret.NatType, ret.TimeZone, _ = getHostInfo()
|
cpuType, ret.Uptime, ret.Platform, ret.Kernel, ret.Arch, ret.VmType, ret.NatType, ret.TimeZone, _ = getHostInfo()
|
||||||
@@ -40,14 +41,16 @@ func GetHost() *model.SystemInfo {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetSystemInfo() {
|
func CheckSystemInfo() {
|
||||||
ret := GetHost()
|
ret := GetSystemInfo()
|
||||||
fmt.Println("Cpu Model :", ret.CpuModel)
|
fmt.Println("Cpu Model :", ret.CpuModel)
|
||||||
fmt.Println("Cpu Cores :", ret.CpuCores)
|
fmt.Println("Cpu Cores :", ret.CpuCores)
|
||||||
if ret.CpuCache != "" {
|
if ret.CpuCache != "" {
|
||||||
fmt.Println("Cpu Cache :", ret.CpuCache)
|
fmt.Println("Cpu Cache :", ret.CpuCache)
|
||||||
}
|
}
|
||||||
fmt.Println("AES-NI :", ret.CpuAesNi)
|
if runtime.GOOS != "windows" && runtime.GOOS != "macos" {
|
||||||
|
fmt.Println("AES-NI :", ret.CpuAesNi)
|
||||||
|
}
|
||||||
fmt.Println("VM-x/AMD-V/Hyper-V :", ret.CpuVAH)
|
fmt.Println("VM-x/AMD-V/Hyper-V :", ret.CpuVAH)
|
||||||
fmt.Println("RAM :", ret.MemoryUsage+" / "+ret.MemoryTotal)
|
fmt.Println("RAM :", ret.MemoryUsage+" / "+ret.MemoryTotal)
|
||||||
if ret.VirtioBalloon != "" {
|
if ret.VirtioBalloon != "" {
|
||||||
|
Reference in New Issue
Block a user