From 4314a0567bd072dc4f9893300b26be535b0c407c Mon Sep 17 00:00:00 2001 From: Yalcin Ozbek Date: Sat, 5 Nov 2022 16:37:04 +0300 Subject: [PATCH] the code has been moved outside the loop. Signed-off-by: Yalcin Ozbek --- cpu/cpu_linux.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cpu/cpu_linux.go b/cpu/cpu_linux.go index 597777c..165a34d 100644 --- a/cpu/cpu_linux.go +++ b/cpu/cpu_linux.go @@ -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 }