Skip to content

Commit 64af920

Browse files
authored
Merge pull request #2364 from carlosedp/riscv64
Ignore CPU clock for riscv64
2 parents 0ff17b8 + 77aef51 commit 64af920

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

machine/machine.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ const nodePath = "/sys/devices/system/node"
5454

5555
// GetClockSpeed returns the CPU clock speed, given a []byte formatted as the /proc/cpuinfo file.
5656
func GetClockSpeed(procInfo []byte) (uint64, error) {
57-
// s390/s390x, aarch64 and arm32 changes
58-
if isSystemZ() || isAArch64() || isArm32() {
57+
// s390/s390x, riscv64, aarch64 and arm32 changes
58+
if isSystemZ() || isAArch64() || isArm32() || isRiscv64() {
5959
return 0, nil
6060
}
6161

@@ -448,6 +448,15 @@ func isSystemZ() bool {
448448
return false
449449
}
450450

451+
// riscv64 changes
452+
func isRiscv64() bool {
453+
arch, err := getMachineArch()
454+
if err == nil {
455+
return strings.Contains(arch, "riscv64")
456+
}
457+
return false
458+
}
459+
451460
// s390/s390x changes
452461
func getNumCores() int {
453462
maxProcs := runtime.GOMAXPROCS(0)

0 commit comments

Comments
 (0)