measuring-energy

measuring-energy is a skill for Claude Code from ml-energy/zeus. It costs 67 tokens per session (2,396 once invoked), scanned A, original, Apache-2.0.

A way to measure the energy use and power draw of software running on GPUs, CPUs, memory, and some embedded computer systems. It uses the Zeus Python library and command-line tools to monitor workloads.

In plain words
What is it for?
Use it to measure total energy for a code block, record power over time, profile repeated functions, inspect device counters, or monitor a workload from the command line.
Why use it?
It shows how much energy a computation consumes instead of measuring only its runtime. This helps compare the energy efficiency of different implementations or runs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the zeus plugin — 1 skill shipped together

Good fit Use it to measure total energy for a code block, record power over time, profile repeated functions, inspect device counters, or monitor a workload from the command line.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ml-energy/zeus/measuring-energy
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ml-energy/zeus --skill measuring-energy
Clone the repo
git clone --depth 1 https://github.com/ml-energy/zeus

Made for: Claude Code.

Or install zeus, the plugin that ships this one along with the rest of its 1 skill.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for measuring-energy

README.md
[![agentmods](https://agentmods.dev/badge/skills/ml-energy/zeus/measuring-energy/github.svg)](https://agentmods.dev/skills/ml-energy/zeus/measuring-energy)
Your own site
<a href="https://agentmods.dev/skills/ml-energy/zeus/measuring-energy"><img src="https://agentmods.dev/badge/skills/ml-energy/zeus/measuring-energy/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for measuring-energy

Your own site · 80×15
<a href="https://agentmods.dev/skills/ml-energy/zeus/measuring-energy"><img src="https://agentmods.dev/badge/skills/ml-energy/zeus/measuring-energy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,396 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00067 $0.02396
Opus 5 $0.00034 $0.01198
Sonnet 5 $0.00013 $0.00479
Haiku 4.5 $0.00007 $0.00240

Measured 10d ago against content hash f57ed360ae5d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

measuring-energy scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/measuring-energy/SKILL.md · 156 lines

How it starts

The opening of the file, as written. The whole thing — 156 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Measuring Energy and Power with Zeus

Zeus is a Python library for measuring and optimizing the energy consumption of any computation running on GPUs, CPUs, and SoCs. Install it with pip install zeus (Python 3.10 or later), or pip install 'zeus[apple]' to enable energy measurement on Apple silicon. Run python -m zeus.show_env to check which frameworks and devices Zeus detects. Full documentation: https://ml.energy/zeus

Choosing an API

Goal API
Energy and time of a block of code zeus.monitor.ZeusMonitor
Power draw over time zeus.monitor.PowerMonitor
Low-variance energy per iteration of a repeatable function zeus.profile
Custom tooling on raw device counters zeus.device

For a quick measurement without writing code, run python -m zeus.monitor energy (prints total energy on Ctrl-C) or python -m zeus.monitor power (prints power draw periodically).

Permissions

GPU energy and power measurement requires no special privileges. CPU and DRAM energy measurement uses RAPL (Intel and most modern AMD CPUs), which requires root due to kernel restrictions. Without root, ZeusMonitor reports cpu_energy=None when cpu_indices is omitted or empty, and raises RuntimeError when a non-empty cpu_indices is passed explicitly. Alternatives are running inside Docker as root with the RAPL sysfs directory mounted, or deploying the Zeus daemon (zeusd) and setting ZEUSD_SOCK_PATH so unprivileged processes relay RAPL reads through it.

ZeusMonitor: energy and time of a code block

from zeus.monitor import ZeusMonitor

def run_workload() -> None: ...

if __name__ == "__main__":
    monitor = ZeusMonitor(gpu_indices=[0, 1])

    monitor.begin_window("workload")
    run_workload()
    result = monitor.end_window("workload")

    print(f"{result.time} s, {result.total_energy} J")
    print(result.gpu_energy)  # {0: ..., 1: ...} in Joules
  • gpu_indices=None (default) monitors all GPUs. Indices follow CUDA_VISIBLE_DEVICES (NVIDIA) or HIP_VISIBLE_DEVICES (AMD), so index N is cuda:N in frameworks like PyTorch.
  • end_window returns a Measurement with time (seconds), gpu_energy (dict of GPU index to Joules), cpu_energy and dram_energy (dict of RAPL package index to Joules, or None when unavailable), and soc_energy (Apple silicon or Jetson subsystem energies in millijoules, or None). result.total_energy is the sum of GPU energy only.
  • Multiple windows can be open at once, and they can nest or overlap. Window names must be unique among open windows; use begin_window(key, restart=True) in notebooks where a crashed cell may have left a window open, and end_window(key, cancel=True) to discard a window.
  • begin_window and end_window synchronize asynchronously dispatched GPU computations (torch.cuda.synchronize by default) so the window captures exactly the code inside it. Pass sync_execution_with="jax" or "cupy" to the constructor for those frameworks, or sync_execution=False to begin_window/end_window when the workload uses none of them (otherwise a missing framework raises RuntimeError on machines with GPUs).
  • GPU energy counters update roughly every 100 ms, so a very short window can read zero energy. Constructing with approx_instant_energy=True replaces such zero readings with instant power draw times window duration, which is an approximation, not a measurement. Never enable it unprompted: explain this implication to the user and get their approval first, or lengthen the window instead. The flag is also unsupported on AMD GPUs that cannot report instant power; end_window raises ZeusGPUNotSupportedError there.
  • log_file="measurement.csv" writes one row per completed window.

Read the full file on GitHub · 156 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 156 lines · 67 tokens per session scan A f57ed360ae5d

Subscribe to this mod's changes

measuring-energy is a skill published in the GitHub repository ml-energy/zeus (373 stars, last pushed 2d ago), licensed Apache-2.0. It adds 67 tokens to every session and 2,396 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

meta-paper-write

Use this meta-skill instead of answering directly when the current user asks to draft or produce a new academic/research paper or LaTeX manuscript. It uses multi-skill orchestration for manuscript workflows that need source search, citation planning, experiment or figure/table placeholders, drafting, length checks…

opensquilla/opensquilla · 125 tokens

physicsnemo-discover

Official NVIDIA-authored guidance for navigating PhysicsNeMo — pick the model, datapipe, or example for a SciML/AI4Science task (surrogates, forecasting, downscaling, physics-informed, inverse, generative). Points at existing files via live repo search; never writes code. Do NOT use for installation or environment…

NVIDIA/physicsnemo · 124 tokens

paper-revision-author

Revise independently drafted paper sections into one coherent LaTeX body before the abstract is written.

opensquilla/opensquilla · 24 tokens

torch-geometric

Graph Neural Networks (PyG). Node/graph classification, link prediction, GCN, GAT, GraphSAGE, heterogeneous graphs, molecular property prediction, for geometric deep learning.

synthetic-sciences/openscience · 41 tokens

esm

Comprehensive toolkit for protein language models including ESM3 (generative multimodal protein design across sequence, structure, and function) and ESM C (efficient protein embeddings and representations). Use this skill when working with protein sequences, structures, or function prediction; designing novel…

synthetic-sciences/openscience · 86 tokens

structure-prediction

Protein structure prediction from sequence. ESMFold-based, single GPU, no MSA needed. Predicts 3D structures with pLDDT confidence scores for drug discovery targets.

synthetic-sciences/openscience · 42 tokens