Allow clock field in /proc/cpuinfo as cpu MHz fallback value#269
Allow clock field in /proc/cpuinfo as cpu MHz fallback value#269shirou merged 1 commit intoshirou:masterfrom andhe:ppc64le
Conversation
Needed on ppc64le debian porter boxes atleast. See #230
| 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 { |
There was a problem hiding this comment.
What happens if the unit is not "MHz", but, say, "kHz" or "GHz"? Since I don't have any experience with PPC/Power architecture, I don't know. Of course, "cpu kHz" can be a problem too, but I have not seen that.
There was a problem hiding this comment.
Thanks for your review! Given the current value I'm seeing on the Debian ppc64le porterbox would have been more suitably given in GHz I just assumed the value was always in MHz, but this is just an assumption on my side.... (The real answer is to be found in the kernel source somewhere.)
There was a problem hiding this comment.
I believe here's the answer to the used unit (-> always MHz): http://sources.debian.net/src/linux/4.5.5-1/arch/powerpc/kernel/setup-common.c/?hl=279#L279
|
wonderful! Thank you for joining discussion and contribution! |
Needed on ppc64le debian porter boxes atleast.
See #230
This avoids getting MHz from both sysfs cpufreq and /proc/cpuinfo failing. Previously an error was thrown. With this patch we have MHz value in fallback.