# ⚡ EnergiBridge
**One command-line tool to measure software energy consumption — across every major OS and CPU.**
[](https://github.com/tdurieux/EnergiBridge/actions/workflows/release.yml)
[](https://github.com/tdurieux/EnergiBridge/releases)
[](LICENSE)
[](https://arxiv.org/abs/2312.13897)
[Install](#install) · [Usage](#usage) · [Output](#output) · [Citation](#citation)
## What it does
Measuring how much energy software uses is awkward: every operating system and CPU exposes different, low-level counters, so experiments are hard to set up and even harder to reproduce on another machine.
EnergiBridge wraps **any command** and records power, frequency, temperature, CPU/GPU usage, and memory at fixed intervals to a **CSV** — behind a single interface, so your energy experiments run and reproduce the same way everywhere.
### Platform support
| OS | Intel CPU | AMD CPU | M-series | Intel GPU | Nvidia GPU | AMD GPU | M-series GPU |
| ------- | :-------: | :-----: | :------: | :-------: | :--------: | :-----: | :----------: |
| Linux | ✅ | ✅ | | | ✅ | | |
| Windows | ✅ | ✅ | | | ✅ | | |
| macOS | ✅ | | ✅ | ✅ | | ✅ | ✅ |
## Install
Prebuilt binaries are available on the [releases page](https://github.com/tdurieux/EnergiBridge/releases). To build from source you need a [Rust toolchain](https://rustup.rs/); NVIDIA GPU support additionally requires `nvml`.
Linux
Grant read access to the MSR files (reset on every reboot):
```bash
sudo chgrp -R msr /dev/cpu/*/msr
sudo chmod g+r /dev/cpu/*/msr
```
Build, then grant the binary the `rawio` capability (re-run if you move the binary):
```bash
cargo build -r
sudo setcap cap_sys_rawio=ep target/release/energibridge
```
Windows
EnergiBridge uses LibreHardwareMonitor to read the CPU registry. In an **elevated** command prompt (use `sc.exe` in PowerShell):
```bat
sc create rapl type=kernel binPath=""
sc start rapl
cargo build -r
```
Manage the driver with `sc stop rapl` / `sc delete rapl`.
macOS
```bash
cargo build -r
```
## Usage
```
energibridge [OPTIONS] [COMMAND]...
Options:
-o, --output