summaryrefslogtreecommitdiff
path: root/vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_fallback.go
blob: b9e52aba1762c6ae4a8c9f25a44cfe58d498beae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// 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
}