From fff018d17994e45c9944042fc2e46aa916776383 Mon Sep 17 00:00:00 2001 From: Jrelvas <55360900+Noted-Jrelvas@users.noreply.github.com> Date: Thu, 30 Nov 2023 12:30:08 +0000 Subject: [PATCH] sysinfo: Consolidate cpu fields into struct --- cmd/vinegar/vinegar.go | 2 +- sysinfo/sysinfo.go | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cmd/vinegar/vinegar.go b/cmd/vinegar/vinegar.go index 3d8d2f59..19b3826e 100644 --- a/cmd/vinegar/vinegar.go +++ b/cmd/vinegar/vinegar.go @@ -154,7 +154,7 @@ func Sysinfo(pfx *wine.Prefix) { * Kernel: %s * Wine: %s` - fmt.Printf(info, Version, revision, sysinfo.Distro, sysinfo.CPU, sysinfo.HasAVX, sysinfo.HasSplitLockDetect, sysinfo.Kernel, ver) + fmt.Printf(info, Version, revision, sysinfo.Distro, sysinfo.CPU.Name, sysinfo.CPU.AVX, sysinfo.CPU.SplitLockDetect, sysinfo.Kernel, ver) if sysinfo.InFlatpak { fmt.Println("* Flatpak: [x]") } diff --git a/sysinfo/sysinfo.go b/sysinfo/sysinfo.go index 86879bf0..88c46fbf 100644 --- a/sysinfo/sysinfo.go +++ b/sysinfo/sysinfo.go @@ -8,19 +8,26 @@ import ( "golang.org/x/sys/cpu" ) +type CPUInfo struct { + Name string + AVX bool + SplitLockDetect bool +} + var ( - Kernel string - CPU string - Cards []Card - Distro string - HasAVX = cpu.X86.HasAVX - HasSplitLockDetect bool - InFlatpak bool + Kernel string + CPU CPUInfo + Cards []Card + Distro string + InFlatpak bool ) func init() { Kernel = getKernel() - CPU, HasSplitLockDetect = cpuModel() + + CPU.AVX = cpu.X86.HasAVX + CPU.Name, CPU.SplitLockDetect = cpuModel() + Cards = getCards() Distro = getDistro()