Skip to content

Commit

Permalink
sysinfo: Consolidate cpu fields into struct
Browse files Browse the repository at this point in the history
  • Loading branch information
jrelvas-ipc committed Nov 30, 2023
1 parent 15ea9c4 commit fff018d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/vinegar/vinegar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
}
Expand Down
23 changes: 15 additions & 8 deletions sysinfo/sysinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit fff018d

Please sign in to comment.