Merge pull request #1389 from sgthammer/feature/fix-arm-modelname
fill modelName for all cores in arm64 devices
This commit is contained in:
commit
835767a611
|
@ -242,6 +242,17 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
||||||
c.Family = value
|
c.Family = value
|
||||||
case "model", "CPU part":
|
case "model", "CPU part":
|
||||||
c.Model = value
|
c.Model = value
|
||||||
|
// if CPU is arm based, model name is found via model number. refer to: arch/arm64/kernel/cpuinfo.c
|
||||||
|
if c.VendorID == "ARM" {
|
||||||
|
if v, err := strconv.ParseUint(c.Model, 0, 16); err == nil {
|
||||||
|
modelName, exist := armModelToModelName[v]
|
||||||
|
if exist {
|
||||||
|
c.ModelName = modelName
|
||||||
|
} else {
|
||||||
|
c.ModelName = "Undefined"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
case "model name", "cpu":
|
case "model name", "cpu":
|
||||||
c.ModelName = value
|
c.ModelName = value
|
||||||
if strings.Contains(value, "POWER8") ||
|
if strings.Contains(value, "POWER8") ||
|
||||||
|
@ -285,16 +296,6 @@ func InfoWithContext(ctx context.Context) ([]InfoStat, error) {
|
||||||
c.Microcode = value
|
c.Microcode = 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 c.CPU >= 0 {
|
if c.CPU >= 0 {
|
||||||
finishCPUInfo(&c)
|
finishCPUInfo(&c)
|
||||||
ret = append(ret, c)
|
ret = append(ret, c)
|
||||||
|
|
Loading…
Reference in New Issue