Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jig/raspi-cpufreq
https://github.com/jig/raspi-cpufreq
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jig/raspi-cpufreq
- Owner: jig
- Created: 2023-08-20T16:03:14.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-20T16:18:13.000Z (about 1 year ago)
- Last Synced: 2024-04-14T15:51:31.483Z (7 months ago)
- Language: Go
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# raspi-cpufreq
Minimal package to read ARM CPU frequency of the Raspberry Pi 4.
```go
import (
"log"cpufreq "github.com/jig/raspi-cpufreq"
)func main() {
freq, err := cpufreq.Get()
if err != nil {
log.Fatal(err)
}
log.Printf("CPU frequency is %.1f GHz (range from %.1f GHz to %.1f GHz)", float64(freq)/1_000_000, float64(minFreq)/1_000_000, float64(maxFreq)/1_000_000)
}```
# Command line
```bash
cd cmd/freq
go build
go installfreq
```Example output:
```bash
2023/08/20 18:14:59 CPU frequency is 1.5 GHz (range from 0.6 GHz to 1.5 GHz)
```