You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gopsutil/cpu/cpu_darwin_fallback.go

14 lines
386 B
Go

// SPDX-License-Identifier: BSD-3-Clause
//go:build darwin && !arm64
package cpu
import "golang.org/x/sys/unix"
func getFrequency() (float64, error) {
// Use the rated frequency of the CPU. This is a static value and does not
// account for low power or Turbo Boost modes.
cpuFrequency, err := unix.SysctlUint64("hw.cpufrequency")
return float64(cpuFrequency) / 1000000.0, err
}