use Processor entry as model name fallback by @tmm1

pull/338/head
WAKAYAMA Shirou 8 years ago
parent 423a8ff2a6
commit a63f1aeeec

@ -108,6 +108,7 @@ func Info() ([]InfoStat, error) {
lines, _ := common.ReadLines(filename)
var ret []InfoStat
var processorName string
c := InfoStat{CPU: -1, Cores: 1}
for _, line := range lines {
@ -119,6 +120,8 @@ func Info() ([]InfoStat, error) {
value := strings.TrimSpace(fields[1])
switch key {
case "Processor":
processorName = value
case "processor":
if c.CPU >= 0 {
err := finishCPUInfo(&c)
@ -127,7 +130,7 @@ func Info() ([]InfoStat, error) {
}
ret = append(ret, c)
}
c = InfoStat{Cores: 1}
c = InfoStat{Cores: 1, ModelName: processorName}
t, err := strconv.ParseInt(value, 10, 64)
if err != nil {
return ret, err

Loading…
Cancel
Save