Energy analysis#

Introduction#

As part of the EAS development efforts, support for CPU energy models and energy probes was added to LISA.

Energy model#

The EnergyModel class mimics the energy model used by EAS, and lets us do some energy analysis.

Tip

An EnergyModel instance can be generated from a live target using from_target(), providing this target does have an energy model.

Its most noteworthy use is in our EAS behavioural tests, as it lets us estimate the amount of energy consumed in an execution trace and compare this to an estimated energy-optimal placement.

See also

See EnergyModel for more details.

Energy meters#

All energy meters inherit from lisa.energy_meter.EnergyMeter, and most of them use one of devlib’s devlib.instrument under the hood.

See also

See EnergyMeter for more details.

HWMON#

The hwmon is a generic Linux kernel subsystem, providing access to hardware monitoring components like temperature or voltage/current sensors.

Arm Energy probe (AEP)#

ARM Energy Probes are lightweight power measurement tools for software developers. They can monitor up to three voltage rails simultaneously.

See also

Its related class is AEP.

Equipment#

The required equipment is the following:

  • An ARM Energy Probe

  • A shunt resistor to be connected between the voltage rail and the probe. The voltage drop on the resistor must be at most 165 mv. Therefore depending on the maximum current required by the load, one can properly select the value of the shunt resistor

  • Install caiman required libraries:

    sudo apt-get install libudev-dev
    
  • Clone, compile and install the caiman tool.

    git clone https://github.com/ARM-software/caiman.git
    cd caiman/caiman && cmake . && make && cd -
    cp caiman/caiman /usr/bin
    
Arm Energy Probe

Baylibre ACME cape#

The iiocapture instrument exploits the BayLibre ACME solution for measuring power.

To use this instrument you need the following hardware:

See also

Its related class is ACME.

Setting up the board#

First step is to get an IIO version of the ACME BeagleBone black image. The recommended way of using ACME is to use the pre-built image provided by BayLibre.

If you are using a MicroSD card, please ensure that the card is properly inserted in its slot and to keep pressed the power push-button while connecting the power (via the miniUSB cable). Here is an image of the configuration we usually use:

_images/ACMECapeBoardConfiguration.png

To change the IP address and avoid a buggy route to a /8 to be added on your host, change the address of the board in /usr/bin/acme-usbgadget-udhcpd:

# Use an address that does not clash with your existing networks
#ifconfig usb0 up 10.65.34.1 netmask 255.255.255.0
ifconfig usb0 up 192.168.50.1 netmask 255.255.255.0

Fix the DHCP server config on the ACME board to advertise a small subnet instead of a whole /8:

#start          10.65.34.20     #default: 192.168.0.20
#end            10.65.34.254    #default: 192.168.0.254

# Advertise a /24 subnet which contains both the
#allocated addresses and the address of the board itself
option  subnet  255.255.255.0
start           192.168.50.20
end             192.168.50.254

Once the board is booted, by default it has its IP address associated with the baylibre-acme.local hostname. To check for the board being visible in your network, you can use this command

avahi-browse -a

which will list all the reachable devices.

If you do not want to use avahi, you can refer to it by the static IP of the ethernet-over-USB interface. That has the added benefit of not using the board of somebody else, since that IP is on the USB interface which can only be accessed from your local machine.

Setting up iio-capture#

Install the iio-capture tool required libraries:

  • If libiio-* is available from the repositories in your apt-get, then run sudo apt-get install libiio-utils libiio-dev

  • Otherwise, follow the instructions on the libiio wiki on how to build it

  • Clone, compile and install the iio-capture tool

git clone https://github.com/BayLibre/iio-capture.git
cd iio-capture && make && sudo make install && cd -

You can now verify your installation and check that the probes are correctly detected by the iio daemon running on the BeagleBone with a simple command:

iio_info -n baylibre-acme.local

If you have any issues, for example if iio_info hangs, or iio-capture reports “Unsupported write attribute ‘in_oversampling_ratio’”, try rebooting the ACME by SSH:

# (replace baylibre-acme.local if you changed the hostname)
ssh root@baylibre-acme.local reboot

Monsoon Power Monitor#

The Monsoon energy meter allows collecting data from Monsoon Solutions Inc’s Power Monitor.

See also

Its related class is Monsoon.

Setup#

This meter depends on the monsoon.py script from AOSP. To set this up, download that script from here and run pip install gflags pyserial.

The Power Monitor acts as a power supply as well as an energy meter. LISA doesn’t currently automate setting this up. You’ll need to manually run these commands:

API#