From 9d51bfe3bba48ea350a80b6a746d274692fdc602 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Fri, 14 Oct 2016 11:56:47 +0000 Subject: [PATCH] Allow clock field in /proc/cpuinfo as cpu MHz fallback value Needed on ppc64le debian porter boxes atleast. See #230 --- cpu/cpu_linux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/cpu_linux.go b/cpu/cpu_linux.go index 71d3884..3537b2d 100644 --- a/cpu/cpu_linux.go +++ b/cpu/cpu_linux.go @@ -152,9 +152,9 @@ func Info() ([]InfoStat, error) { return ret, err } c.Stepping = int32(t) - case "cpu MHz": + case "cpu MHz", "clock": // treat this as the fallback value, thus we ignore error - if t, err := strconv.ParseFloat(value, 64); err == nil { + if t, err := strconv.ParseFloat(strings.Replace(value, "MHz", "", 1), 64); err == nil { c.Mhz = t } case "cache size":