thermal-governor

command
v0.6.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

thermal-governor

thermal-governor demonstrates github.com/tmc/apple/x/thermal with zero cgo (CGO_ENABLED=0):

  • Reads live macOS thermal state via Foundation's NSProcessInfo.thermalState
  • Detects active power source and battery percentage via IOKit's IOPSCopyPowerSourcesInfo
  • Samples Apple Silicon SoC power/energy via x/powersample (unprivileged libIOReport.dylib with graceful degradation if power sampling is unavailable)
  • Watches thermal state during a synthetic compute workload, evaluates the benchmark qualification gate (thermal.DefaultGate()), and reports joules per token

Run

CGO_ENABLED=0 go run ./examples/os/thermal-governor

Flags:

  • -duration: synthetic workload duration (default 600ms)
  • -interval: thermal watch and power sample interval (default 150ms)
  • -tokens: synthetic token count for joules/token calculation (default 512)

Measured Output

Captured on this Mac with CGO_ENABLED=0 go run ./examples/os/thermal-governor:

== Host Status ==
  thermal state : fair
  power source  : ac (100%)
  idle power    : 12.02 W combined (CPU 11.72 W, GPU 0.30 W, ANE 0.00 W; 3 samples)

== Synthetic Compute Workload (600ms, 512 synthetic tokens) ==
  [watch #1] state=fair power=ac (100%)
  [watch #2] state=fair power=ac (100%)
  [watch #3] state=fair power=ac (100%)
  [watch #4] state=fair power=ac (100%)

== Benchmark Qualification & Energy Summary ==
  elapsed       : 600ms
  watch samples : 4
  thermal       : fair -> fair
  power source  : ac (100%) -> ac (100%)
  gate verdict  : FAIL (thermal: state exceeds benchmark gate: before=fair after=fair max=nominal)
  energy        : 7.547 J combined (CPU 7.395 J, GPU 0.152 J, ANE 0.000 J)
  average power : 12.33 W combined (CPU 12.08 W, GPU 0.25 W, ANE 0.00 W; 5 samples)
  efficiency    : 0.01474 J/token (512 tokens)

Documentation

Rendered for darwin/amd64

Overview

Command thermal-governor demonstrates github.com/tmc/apple/x/thermal.

It prints the live host thermal state, AC/battery power source, and an initial SoC power sample, then runs a short synthetic compute workload while watching thermal state, evaluates the benchmark qualification gate, and reports energy per token.

Run directly:

go run ./examples/os/thermal-governor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL