Simplify getNodeIdFromCpuBus
This commit is contained in:
parent
4066d8b476
commit
29824ab110
@ -170,23 +170,13 @@ func getNodeIdFromCpuBus(cpuBusPath string, threadId int) (int, error) {
|
|||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
filename := file.Name()
|
filename := file.Name()
|
||||||
|
|
||||||
isNode, error := regexp.MatchString("^node([0-9]+)$", filename)
|
|
||||||
if error != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if !isNode {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
ok, val, _ := extractValue(filename, nodeBusRegExp)
|
ok, val, _ := extractValue(filename, nodeBusRegExp)
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if ok {
|
if ok {
|
||||||
if val < 0 {
|
if val < 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
nodeId = val
|
nodeId = val
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user