ci: fixup macos runner type
1 file changed
tree: b46ce57c694647da3bb16307a7f4276c32d33ded
  1. .github/
  2. .golangci.yaml
  3. cpu.go
  4. cpu_test.go
  5. go.mod
  6. go.sum
  7. incompatible.go
  8. LICENSE
  9. Makefile
  10. README.md
README.md

m1cpu

Go Reference MPL License Run CI Tests

The go-m1cpu module is a library for inspecting Apple Silicon CPUs in Go.

Use the m1cpu library for looking up the CPU frequency for Apple M1 and M2 CPUs.

Install

go get github.com/shoenig/go-m1cpu@latest

Example

package main

import (
    "fmt"

    "github.com/shoenig/go-m1cpu"
)

func main() {
    fmt.Println("pCore", m1cpu.PCoreGHz())
    fmt.Println("eCore", m1cpu.ECoreGHz())
}

CGO

This package requires the use of CGO. Extracting the CPU properties is done via Apple's IOKit framework, which is accessible only through system C libraries.

License

Open source under the MPL