Measure energy consumption at source code level

NodeJS

Oaklean

Description

Oaklean is a groundbreaking software solution that helps developers visualize and optimize the energy consumption of NodeJS applications. Through an innovative VSCode extension and an integration into test frameworks, the system identifies energy-intensive code sections and suggests eco-friendly alternatives. The goal is to raise awareness of responsible resource management in software development, aiming to achieve both ecological and economic benefits.

Java

JoularJX

Description

JoularJX is a Java-based agent for power monitoring at the source code level with support for modern Java versions and multi-OS to monitor power consumption of hardware and software.

JoularJX is a Java agent where you can simply hook it to the Java Virtual Machine when starting your Java program. To get power readings, JoularJX uses a custom PowerMonitor program (based on Intel Power Gadget API) on Windows, Intel RAPL (through powercap) on GNU/Linux, and our accurate power models on Raspberry Pi and similar devices.

Research papers:

jPowerMonitor

Description

The power consumption of Java applications should become measurable, and thus visible, with the help of jPowerMonitor. This library includes an extension for measuring unit tests, as well as a Java agent for measuring any Java application. The Java agent collects the activity of the application to be measured at regular, configurable intervals. The agent takes into account the power consumption provided by the configured measurement tool. The CPU usage of the program and the current power consumption are aggregated to energy consumption per method over runtime and written into a CSV file. The result of the measurement is the energy consumption in watt hours or joule.

Python

pyJoules

pyJoules is a software toolkit to measure the energy footprint of a host machine along the execution of a piece of Python code. It monitors the energy consumed by specific device of the host machine such as:

Source code: https://github.com/powerapi-ng/pyJoules
Docs: https://pyjoules.readthedocs.io/en/latest/

CodeCarbon

CodeCarbon is a lightweight software package that seamlessly integrates into your Python codebase. It estimates the amount of carbon dioxide (CO2) produced by the cloud or personal computing resources used to execute the code.

Website: CodeCarbon.io
Source code: GitHub - mlco2/codecarbon
Docs: https://mlco2.github.io/codecarbon/

Research paper

Lottick, K., Susai, S., Friedler, S. A., & Wilson, J. P. (2019). Energy Usage Reports: Environmental awareness as part of algorithmic accountability. https://doi.org/10.48550/arXiv.1911.08354
Blog post about the paper: AI Computing Emits CO₂. We Started Measuring How Much (by Kamal Goyal) | Medium

Methodology

Methodology — CodeCarbon 2.0.0 documentation

Usage

from codecarbon import EmissionsTracker
tracker = EmissionsTracker()
tracker.start()
# GPU Intensive code goes here
tracker.stop()