os-silicon-top
No-sudo, zero-CGo Apple Silicon telemetry cockpit built with x/powersample, x/thermal, x/mempressure, x/workgroup, and x/mach.
What It Demonstrates
- P-core / E-core QoS Pinning (
x/workgroup): Pins a Go goroutine onto performance cores (UserInteractive) inside a parallel os_workgroup and another onto efficiency cores (Background) via workgroup.RunPinned.
- Mach Real-Time Thread Promotion (
x/mach): Locks a goroutine to an OS thread, promotes it via SetTimeConstraint (10ms period / 1ms computation / 4ms constraint), measures wakeup jitter, and demotes cleanly via SetStandard on exit.
- Unprivileged SoC Power (
x/powersample): Streams live CPU, GPU, and ANE wattage via libIOReport.dylib with no sudo.
- Thermal & Jetsam Footprint (
x/thermal, x/mempressure): Reads NSProcessInfo.thermalState, IOPowerSources, task_info(TASK_VM_INFO).phys_footprint, and live Darwin memory-pressure level.
Usage
# Quick CLI run (default 5 samples at 250ms)
CGO_ENABLED=0 go run ./examples/os/os-silicon-top -samples 3
# Continuous live TUI mode
CGO_ENABLED=0 go run ./examples/os/os-silicon-top -watch -interval 250ms
Measured Output
os-silicon-top (zero-CGo, zero-sudo Apple Silicon cockpit)
workgroup="os-silicon-top" max_parallel=16 | P=UserInteractive(0) E=Background(0) | Mach RT=TimeConstraint(10ms/1ms)
--------------------------------------------------------------------------------------------------------------
[01] CPU 16.78W GPU 0.39W ANE 0.00W Tot 17.17W | th=fair pwr=ac (100%) | mem= 12.0MiB(normal) | P= 344 E= 271 RT=81(jit 80500µs)
[02] CPU 14.57W GPU 0.43W ANE 0.00W Tot 15.00W | th=fair pwr=ac (100%) | mem= 12.6MiB(normal) | P= 339 E= 313 RT=72(jit 59944µs)
[03] CPU 13.70W GPU 0.31W ANE 0.00W Tot 14.01W | th=fair pwr=ac (100%) | mem= 13.7MiB(normal) | P= 519 E= 483 RT=95(jit 70445µs)
Average over 3 samples: CPU 15.02W, GPU 0.38W, ANE 0.00W, Combined 15.39W