From 77aef51a9bbc04f81e176d96ab0d310f4c728c1f Mon Sep 17 00:00:00 2001 From: Carlos de Paula Date: Fri, 27 Dec 2019 16:30:49 -0300 Subject: [PATCH] Ignore CPU clock for riscv64 --- machine/machine.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/machine/machine.go b/machine/machine.go index 34ed9b99f6..99ed3eaf73 100644 --- a/machine/machine.go +++ b/machine/machine.go @@ -54,8 +54,8 @@ const nodePath = "/sys/devices/system/node" // GetClockSpeed returns the CPU clock speed, given a []byte formatted as the /proc/cpuinfo file. func GetClockSpeed(procInfo []byte) (uint64, error) { - // s390/s390x, aarch64 and arm32 changes - if isSystemZ() || isAArch64() || isArm32() { + // s390/s390x, riscv64, aarch64 and arm32 changes + if isSystemZ() || isAArch64() || isArm32() || isRiscv64() { return 0, nil } @@ -448,6 +448,15 @@ func isSystemZ() bool { return false } +// riscv64 changes +func isRiscv64() bool { + arch, err := getMachineArch() + if err == nil { + return strings.Contains(arch, "riscv64") + } + return false +} + // s390/s390x changes func getNumCores() int { maxProcs := runtime.GOMAXPROCS(0)