Skip to content

ksctl/vrapl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vRAPL

Per-VM energy attribution using hardware RAPL counters and CPU-time proportional modeling. A host-side daemon that reads real energy data from Intel/AMD RAPL and delivers per-VM power readings to guests via virtio serial port.

Read the manifesto: Open VM Energy Manifesto | Discussion

How it works

  1. Reads host-level energy from /sys/class/powercap/intel-rapl:*/energy_uj (works for both Intel and AMD despite the naming)
  2. Finds the QEMU process for a given VM via libvirt
  3. Computes the VM's energy share: E_vm = E_host × (T_vm / T_total)
  4. Writes the attributed power (watts) to the VM via a virtio serial port every 2 seconds

The guest reads its energy data from /dev/ttyS1 — no agent, no driver, no network stack needed.

Prerequisites

  • Linux host with RAPL support (/sys/class/powercap/intel-rapl:* must exist)
  • QEMU/KVM with libvirt
  • A VM configured with a virtio serial port
  • Root access (RAPL and libvirt require it)
  • Go 1.25+ and libvirt-dev headers

Build

make build

Demo (with virtio serial port)

On the host — start the daemon, pointing it at your VM name and the PTY path that QEMU allocated for the serial port:

sudo ./vrapl <VM_NAME> <SERIAL_PATH>
# Example:
sudo ./vrapl ubuntu25.04 /dev/pts/2

Note: The PTY path is not deterministic. Check virsh dumpxml <VM_NAME> or QEMU logs to find the allocated path.

Inside the guest — read the energy data:

sudo cat /dev/ttyS1

You'll see real-time power attribution:

First successful test — host RAPL energy attributed to a VM via virtio serial

Status

This is an early proof of concept demonstrating the virtio serial port delivery mechanism. See the Open VM Energy Manifesto for the broader proposal to cloud providers.

License

See LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors