Merge pull request #964 from yghannam/master
ClockSpeed not defined in /proc/cpuinfo for AArch64, so return 0.
This commit is contained in:
commit
7486c6fbd4
@ -43,8 +43,8 @@ var swapCapacityRegexp = regexp.MustCompile("SwapTotal: *([0-9]+) kB")
|
|||||||
|
|
||||||
// GetClockSpeed returns the CPU clock speed, given a []byte formatted as the /proc/cpuinfo file.
|
// GetClockSpeed returns the CPU clock speed, given a []byte formatted as the /proc/cpuinfo file.
|
||||||
func GetClockSpeed(procInfo []byte) (uint64, error) {
|
func GetClockSpeed(procInfo []byte) (uint64, error) {
|
||||||
// s390/s390x changes
|
// s390/s390x and aarch64 changes
|
||||||
if true == isSystemZ() {
|
if true == isSystemZ() || true == isAArch64() {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,6 +273,17 @@ func getMachineArch() (string, error) {
|
|||||||
return arch, nil
|
return arch, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// aarch64 changes
|
||||||
|
func isAArch64() bool {
|
||||||
|
arch, err := getMachineArch()
|
||||||
|
if err == nil {
|
||||||
|
if true == strings.Contains(arch, "aarch64") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// s390/s390x changes
|
// s390/s390x changes
|
||||||
func isSystemZ() bool {
|
func isSystemZ() bool {
|
||||||
arch, err := getMachineArch()
|
arch, err := getMachineArch()
|
||||||
|
Loading…
Reference in New Issue
Block a user