the code has been moved outside the loop.

Signed-off-by: Yalcin Ozbek <yalcinozbekceng@gmail.com>
This commit is contained in:
Yalcin Ozbek 2022-11-05 16:37:04 +03:00
parent 13f00fde46
commit 4314a0567b
No known key found for this signature in database
GPG Key ID: BB0DF4A7800295ED
1 changed files with 10 additions and 10 deletions

View File

@ -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
}