Skip to content

energy_apple

energy_apple

Apple Silicon energy monitor — via zeus-ml[apple] or CPU-time estimation.

Classes

AppleEnergyMonitor

AppleEnergyMonitor(poll_interval_ms: int = 50)

Bases: EnergyMonitor

Apple Silicon energy monitor.

Prefers zeus-ml[apple] AppleSiliconMonitor when available. Falls back to a CPU-time-based estimation using the chip's known TDP, which gives order-of-magnitude correct energy readings without root.

Source code in src/openjarvis/telemetry/energy_apple.py
def __init__(self, poll_interval_ms: int = 50) -> None:
    self._poll_interval_ms = poll_interval_ms
    self._monitor = None
    self._zeus_ok = False
    self._chip_name, self._tdp_watts = _detect_chip()

    if _ZEUS_APPLE_AVAILABLE and platform.system() == "Darwin":
        try:
            self._monitor = AppleSiliconMonitor()
            self._zeus_ok = True
        except Exception as exc:
            logger.debug(
                "Failed to initialize Apple Silicon energy monitor: %s",
                exc,
            )