mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 15:29:04 +01:00
Lookup core ID from /sys/devices/system/cpu, /proc/cpuinfo is not portable
This commit is contained in:
parent
35c20110ca
commit
fd56a14eb6
@ -71,13 +71,6 @@ func init() {
|
||||
return
|
||||
}
|
||||
cache.HwthreadList = append(cache.HwthreadList, id)
|
||||
case "core id":
|
||||
id, err := strconv.Atoi(value)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
return
|
||||
}
|
||||
cache.CoreList = append(cache.CoreList, id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -134,6 +127,7 @@ func init() {
|
||||
return id
|
||||
}
|
||||
|
||||
cache.CoreList = make([]int, len(cache.HwthreadList))
|
||||
cache.DieList = make([]int, len(cache.HwthreadList))
|
||||
cache.SMTList = make([]int, len(cache.HwthreadList))
|
||||
cache.NumaDomainList = make([]int, len(cache.HwthreadList))
|
||||
@ -146,6 +140,9 @@ func init() {
|
||||
)
|
||||
topoBase := filepath.Join(base, "topology")
|
||||
|
||||
// Lookup Core ID
|
||||
cache.CoreList[i] = fileToInt(filepath.Join(topoBase, "core_id"))
|
||||
|
||||
// Lookup CPU die id
|
||||
cache.DieList[i] = fileToInt(filepath.Join(topoBase, "die_id"))
|
||||
if cache.DieList[i] < 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user