Skip to content

Repository files navigation

EcoFloc: Energy Measuring System Tool for Linux

Acknowledgments

EcoFloc was developed by the R&D laboratory of Technopôle Domolandes1, with support from Université de Pau et des Pays de l'Adour and Université de Toulouse. These institutions play a key role in advancing research and innovation, contributing to technological progress and regional development in France.

Description

EcoFloc is a versatile tool that measures the energy consumption of processes based on the load they generate on CPU, GPU, RAM, storage devices (SD), and network interface controllers (NIC). It supports independent per-component measurement, interval-based sampling, and long-term monitoring, persisting data even if applications restart. EcoFloc can analyze existing applications or launch new ones from the boot process to track their energy usage from the start.

Power calculation

EcoFloc estimates energy consumption per hardware component based on the load generated by running processes. It uses data from GNU/Linux kernel interfaces when available; otherwise, it relies on predefined or user-customized hardware specs.

This release includes pre-defined formulas for the five hardware components2. Future updates will add more methods and kernel-level interfaces like RAPL3, giving users flexible measurement options.

Limitations

Like any software-based energy measurement tool, EcoFloc provides approximations and should not be considered absolutely precise.

Dependencies

EcoFloc requires an Arch-based or Debian-based GNU/Linux distribution with Linux kernel 5.12 or higher.

To collect hardware metrics, install the following packages:

  • CPU: msr-tools
  • GPU: nvidia-smi (yes, this version only supports NVIDIA GPUs :-) )
  • RAM: glibc (for iconv) and perf
  • NIC: nethogs ≥ 0.8.7
# Arch-based distributions
pacman -S msr-tools glibc linux-tools nethogs nvidia-smi  # Use 'linux-zen-tools' instead if running the Zen kernel  

# Debian-based distributions
apt-get update
apt-get install msr-tools libc-bin linux-tools-common linux-tools-$(uname -r) nethogs nvidia-smi  

# If nethogs ≥ 0.8.7 is unavailable, check:
# https://launchpad.net/ubuntu/kinetic/arm64/nethogs/0.8.7-1

Configuration

EcoFloc needs the power profile of each hardware component, along with some custom information, such as the network interface to monitor for NIC analysis. While EcoFloc attempts to detect these values automatically, please update the _settings.conf file in each hardware folder. You can find the required values in the hardware datasheets, usually available on the manufacturer’s website.

Installation

Automated Installation

To install EcoFloc, run the following command as root:

/bin/bash ecofloc_installer.sh  # Requires Python 3  

At the end of the installation, a summary will display any potential issues. If you believe these issues are not valid and still want to test EcoFloc, proceed with the manual compilation steps below.

Manual Compilation and Installation

  1. Navigate to the project root
cd /path/to/ecofloc  
  1. Clean previous builds
make clean  
  1. Compile and install
make  
make install  
  1. Uninstall if needed
make uninstall  

Running EcoFloc

To use EcoFloc, execute the ecofloc command as root with the following options:

Which component to analyze

  1. Hardware - The first parameter to specify is the hardware component to analyze. For example:
ecofloc --cpu ...  

What to analyze

EcoFloc can analyze an existing process or application, or launch an application to monitor its execution, including its boot process.

  1. Process ID (PID) (-p) – Analyze an already running process by specifying its PID.
  2. Application Name (-n) – Monitor all PIDs associated with an existing application.
  3. Launch Application (-l) – Start an application and analyze only its main PID.
  4. Launch Application (-L) – Start an application and monitor all PIDs associated with its name. (If an instance is already running, it will be included in the analysis.)
  5. System Mode (-S) – (Beta) Analyze the entire system, aggregating the energy consumption of all running processes.

Time parameters

Then, specify the measuring interval and total analysis time:

  1. Total Analysis Time (-t) – Defines the measurement duration. A negative value enables continuous analysis, which can be stopped with Ctrl+C to display results.
  2. Measurement Interval (-i) – Sets how often EcoFloc collects load and power data. Smaller values may increase CPU usage.

Extra Parameters

  1. Dynamic Mode (-d) – Allows EcoFloc to track applications that may be closed and reopened during analysis.
  2. Export Mode (-f) – Saves measurement results to a CSV file at the specified path. If set to default, EcoFloc will use the path defined in settings.conf inside each component folder. The file includes, for each interval: measurement time, PID, average power, and energy consumed.
  3. Verbose Mode (-v) – Shows warnings, especially when -l or -L is used.

Execution Commands

Run EcoFloc using the following format:

ecofloc --cpu -p or -n [PID or App Name] or -l or -L [App Name] or -S -i [interval] -t [duration] -d -v -f [path]  
ecofloc --sd  -p or -n [PID or App Name] or -l or -L [App Name] or -S -i [interval] -t [duration] -d -v -f [path]  
ecofloc --nic -p or -n [PID or App Name] or -l or -L [App Name] or -S -i [interval] -t [duration] -d -v -f [path]  
ecofloc --ram -p or -n [PID or App Name] or -l or -L [App Name] or -S -i [interval] -t [duration] -d -v -f [path]  
ecofloc --gpu -p or -n [PID or App Name] or -l or -L [App Name] or -S -i [interval] -t [duration] -d -v -f [path]  

Outputs

After the specified timeout or when you press Ctrl+C, EcoFloc will display:

  • Average Power (Watts): Mean power consumption over the total analysis time.
  • Energy Consumption (Joules): Total energy used during the analysis.

Usage Examples

Example 1: Analyze a Specific Process

To check the CPU energy usage of a process with PID 20300, sampling every 1000ms for 10 seconds, run:

ecofloc --cpu -p 20300 -i 1000 -t 10 -f /home/user/  

You'll see something like this:

/*****************************  
/ECOFLOC_RAM_PID_20300  
*****************************/  
Average Power (CPU): 0.47 Watts  
Total CPU Energy (CPU): 4.72 Joules  
*****************************  

With -f, EcoFloc saves a .csv file in the specified path (e.g., /home/user/). The filename includes the component and process (e.g., /ECOFLOC_RAM_PID_20300.csv).

If you use default (-f default), the file goes to the path set in features.conf inside the project folder.

Each row in the .csv includes: PID, average power (Watts), and energy consumed (Joules).

Example 2: Analyze the Chrome Application

To monitor Chrome's GPU usage, tracking all its PIDs every 1000ms, running until you stop it (-t -1), run:

ecofloc --gpu -n chrome -i 1000 -t -1 -d  

The -d flag lets EcoFloc keep running even if Chrome closes and reopens.

You'll see something like this:

/*****************************  
/ECOFLOC_SD_COMM_chrome  
*****************************/  
Average Power (GPU): 1.98 Watts  
Total GPU Energy (GPU): 39.6 Joules  
*****************************  

References

Footnotes

  1. Technopole Domolandes ↩

  2. Humberto, A.V.H.: An energy-saving perspective for distributed environments: Deployment, scheduling and simulation with multidimensional entities for Software and Hardware. Ph.D. thesis, UPPA, https://www.theses.fr/s342134 (2022) ↩

  3. Running Average Power Limit (RAPL): Intel® 64 and IA-32 Architectures Software Developer's Manual, specifically in the section detailing power and thermal management. ↩

About

No description, website, or topics provided.

Resources

Stars

31 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages