the code has been moved outside the loop.

Signed-off-by: Yalcin Ozbek <yalcinozbekceng@gmail.com>
pull/1373/head
Yalcin Ozbek 2 years ago
parent 13f00fde46
commit 4314a0567b
No known key found for this signature in database
GPG Key ID: BB0DF4A7800295ED

@ -244,16 +244,6 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
c.Model = value
case "model name", "cpu":
c.ModelName = value
if c.VendorID == "ARM" && c.ModelName == "" {
if v, err := strconv.ParseUint(c.Model, 0, 16); err == nil {
modelName, exist := armModelToModelName[v]
if exist {
c.ModelName = modelName
} else {
c.ModelName = "Undefined"
}
}
}
if strings.Contains(value, "POWER8") ||
strings.Contains(value, "POWER7") {
c.Model = strings.Split(value, " ")[0]
@ -299,6 +289,16 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
finishCPUInfo(&c)
ret = append(ret, c)
}
if c.VendorID == "ARM" && c.ModelName == "" {
if v, err := strconv.ParseUint(c.Model, 0, 16); err == nil {
modelName, exist := armModelToModelName[v]
if exist {
c.ModelName = modelName
} else {
c.ModelName = "Undefined"
}
}
}
return ret, nil
}

Loading…
Cancel
Save