mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-24 13:48:56 +08:00
14 lines
386 B
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
|
|
}
|