Fix DieList() if system does not support dies. Explicitly set entries in CpuData list

This commit is contained in:
Thomas Roehl 2022-03-22 15:58:10 +01:00
parent c506114480
commit 622e94ae0e

View File

@ -169,8 +169,11 @@ func DieList() []int {
} }
} }
} }
if len(dielist) > 0 {
return dielist return dielist
} }
return SocketList()
}
type CpuEntry struct { type CpuEntry struct {
Cpuid int Cpuid int
@ -261,7 +264,7 @@ func CpuData() []CpuEntry {
for _, c := range CpuList() { for _, c := range CpuList() {
clist = append(clist, CpuEntry{Cpuid: c}) clist = append(clist, CpuEntry{Cpuid: c})
} }
for _, centry := range clist { for i, centry := range clist {
centry.Socket = -1 centry.Socket = -1
centry.Numadomain = -1 centry.Numadomain = -1
centry.Die = -1 centry.Die = -1
@ -289,6 +292,8 @@ func CpuData() []CpuEntry {
// Lookup NUMA domain id // Lookup NUMA domain id
centry.Numadomain = getNumaDomain(base) centry.Numadomain = getNumaDomain(base)
// Update values in output list
clist[i] = centry
} }
return clist return clist
} }