mirror of
https://github.com/oneclickvirt/basics.git
synced 2025-10-06 17:17:15 +08:00
update
This commit is contained in:
@@ -85,7 +85,7 @@ func getCpuInfo(ret *model.SystemInfo, cpuType string) (*model.SystemInfo, error
|
||||
ret.CpuModel = strings.TrimSpace(strings.Join(fields[1:], " "))
|
||||
} else if strings.Contains(fields[0], "cache size") {
|
||||
ret.CpuCache = strings.TrimSpace(strings.Join(fields[1:], " "))
|
||||
} else if strings.Contains(fields[0], "cpu MHz") {
|
||||
} else if strings.Contains(fields[0], "cpu MHz") && !strings.Contains(ret.CpuModel, "@") {
|
||||
ret.CpuModel += " @ " + strings.TrimSpace(strings.Join(fields[1:], " ")) + " MHz"
|
||||
}
|
||||
}
|
||||
@@ -102,9 +102,9 @@ func getCpuInfo(ret *model.SystemInfo, cpuType string) (*model.SystemInfo, error
|
||||
for _, line := range lines {
|
||||
fields := strings.Split(line, ":")
|
||||
if len(fields) >= 2 {
|
||||
if strings.Contains(fields[0], "Model name") {
|
||||
if strings.Contains(fields[0], "Model name") && !strings.Contains(fields[0], "BIOS Model name") && ret.CpuModel == "" {
|
||||
ret.CpuModel = strings.TrimSpace(strings.Join(fields[1:], " "))
|
||||
} else if strings.Contains(fields[0], "CPU MHz") {
|
||||
} else if strings.Contains(fields[0], "CPU MHz") && !strings.Contains(ret.CpuModel, "@") {
|
||||
ret.CpuModel += " @ " + strings.TrimSpace(strings.Join(fields[1:], " ")) + " MHz"
|
||||
} else if strings.Contains(fields[0], "L1d cache") {
|
||||
L1dcache = strings.TrimSpace(strings.Join(fields[1:], " "))
|
||||
|
@@ -3,6 +3,7 @@ package system
|
||||
import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
|
||||
"github.com/oneclickvirt/basics/system/model"
|
||||
"github.com/oneclickvirt/basics/system/utils"
|
||||
)
|
||||
@@ -43,10 +44,10 @@ func CheckSystemInfo(language string) string {
|
||||
ret := GetSystemInfo()
|
||||
var res string
|
||||
if language == "en" {
|
||||
res += " Cpu Model : " + ret.CpuModel + "\n"
|
||||
res += " Cpu Cores : " + ret.CpuCores + "\n"
|
||||
res += " CPU Model : " + ret.CpuModel + "\n"
|
||||
res += " CPU Cores : " + ret.CpuCores + "\n"
|
||||
if ret.CpuCache != "" {
|
||||
res += " Cpu Cache : " + ret.CpuCache + "\n"
|
||||
res += " CPU Cache : " + ret.CpuCache + "\n"
|
||||
}
|
||||
if runtime.GOOS != "windows" && runtime.GOOS != "macos" {
|
||||
res += " AES-NI : " + ret.CpuAesNi + "\n"
|
||||
@@ -79,10 +80,10 @@ func CheckSystemInfo(language string) string {
|
||||
res += " Tcp Accelerate : " + ret.TcpAccelerationMethod + "\n"
|
||||
}
|
||||
} else if language == "zh" {
|
||||
res += " Cpu 型号 : " + ret.CpuModel + "\n"
|
||||
res += " Cpu 数量 : " + ret.CpuCores + "\n"
|
||||
res += " CPU 型号 : " + ret.CpuModel + "\n"
|
||||
res += " CPU 数量 : " + ret.CpuCores + "\n"
|
||||
if ret.CpuCache != "" {
|
||||
res += " Cpu 缓存 : " + ret.CpuCache + "\n"
|
||||
res += " CPU 缓存 : " + ret.CpuCache + "\n"
|
||||
}
|
||||
if runtime.GOOS != "windows" && runtime.GOOS != "macos" {
|
||||
res += " AES-NI : " + ret.CpuAesNi + "\n"
|
||||
|
Reference in New Issue
Block a user