labDomolandes / ecofloc

Apache License 2.0
21 stars 5 forks source link

EcoFloc: Energy Measuring System Tool for Linux

Acknowledgments

EcoFloc has been made possible thanks to Technopôle Domolandes[^1], an organization deeply committed to innovation and the development of the Landes region in France and beyond, as well as the Université de Pau et des Pays de l'Adour and Université de Toulouse. These institutions are engaged in advancing research and development in France, contributing significantly to technological progress and regional growth. Their continuous efforts have been instrumental in bringing this project to life.

Description

EcoFloc is a comprehensive and versatile tool developed by the R&D laboratory of Technopôle Domolandes[^1], supported by Université de Pau et des Pays de l'Adour and Université de Toulouse.

EcoFloc measures the energy consumption of applications in GNU/Linux environments across several hardware components. In this initial release, it enables independent energy measurement for the CPU, GPU, RAM, storage devices (SD), and network interface controllers (NIC). The tool measures energy at predefined intervals during a specified timeout, allowing users to create detailed energy profiles based on hardware components and behavioral patterns over time. It also features long-term monitoring capabilities, tracking energy usage over extended periods, even if applications are closed and reopened.

Power calculation

EcoFloc calculates the energy consumption for each hardware component based on the load generated by running processes, identified by their PID. It utilizes load and energy data sourced from GNU/Linux kernel interfaces or, if unavailable, from the hardware components' specifications (datasheets), which can be either predefined or customized

In this initial release, EcoFloc includes a set of pre-defined mathematical formulas tailored for the five hardware components [^3]. Developers and contributors have the flexibility to define and maintain their own formulas if needed.

Future versions will incorporate additional mathematical approaches and kernel-level interfaces like RAPL[^2], enabling users to select options that best meet their needs.

Limitations

It is important to note that, like any software tool measuring hardware energy consumption, EcoFloc's results are approximations and should not be considered absolutely precise.

Technical Specifications

In this initial version of EcoFloc, each hardware component—CPU, RAM, SD, GPU, and NIC—is managed by an independent module. You can find and modify the source code and configuration files in their respective folders, each named ecofloc-*.

General System Requirements

EcoFloc requires an Arch-based or Debian-based GNU/Linux distribution with the Linux kernel version 5.12 or higher. Please, refer to each module folder to explore specific requirements.

General Inputs

To use EcoFloc, execute the `ecofloc` command as root with the following options. 1. **Process ID (PID) (`-p`):** The process identifier to analyze. 2. **Application Name (`-n`):** The name of the application to measure (comprises all associated PIDs). 3. **Total Analysis Time (`-t`):** Specifies the measurement duration. Entering a negative value allows for ongoing analysis, which can be terminated and results displayed by pressing `Ctrl+C`. 4. **Measurement Interval (`-i`):** Determines the interval at which EcoFloc takes load and power measurements. Please consider that small interval values can lead to CPU overload. 5. **Dynamic Mode (`-d`):** Enables EcoFloc to evaluate applications that may be closed and reopened during the analysis. 6. **Export Mode (`-f`):** Exports the measurement results to a CSV file at the path specified in the `settings.conf` file. The file will include, for each measured interval: the measurement time, the concerned PID, the average power, and the energy consumed.

Outputs

After executing `ecofloc`, the following output will be displayed: - **Average Power (in Watts):** The mean power consumption over the total analysis time. - **Energy Consumption (in Joules):** Total energy used during the total analysis time.

Compilation and Execution

Automated Installation

To install EcoFloc, run the following command in your terminal as root:

/bin/bash/floc_installer.sh

This script requires Python3 to be installed on your system. It installs both the EcoFloc console application and a user interface that can be executed with the ecoflocUI command.

Manual Compilation and Installation

To compile and install the EcoFloc project on your system, follow these steps:

  1. Open your terminal.
  2. Navigate to the root directory of the FLOC project:
    • Use the cd command to change to the project directory.
  3. Compile the project and manage installations:
    • Execute make clean to delete all executable files from the local folder.
    • Execute make to compile the project and install FLOC, making it ready for use.
    • Use make uninstall to remove FLOC from your system.
    • Use make install to copy FLOC onto your system, allowing it to be used as a common GNU/Linux command.

Running FLOC:

To use EcoFloc and specify which application to execute, run:

./floc --cpu -p or -n [PID or App Name] -i [interval] -t [duration] -d -f 
./floc --sd -p or -n [PID or App Name] -i [interval] -t [duration] -d -f 
./floc --nic -p or -n [PID or App Name] -i [interval] -t [duration] -d -f 
./floc --ram -p or -n [PID or App Name] -t [duration] -d -f 
./floc --gpu -p or -n [PID or App Name] -t [duration] -d -f 

Usage Examples

Example 1: Analyze a Specific Process

To analyze the process with PID 20300 for 10 seconds at an interval of 1000 milliseconds for the CPU, use the following command:

./floc --cpu -p 20300 -i 1000 -t 10 -f

This command will output the results in the console in the following format:

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

Additionally, the -f flag configures EcoFloc to write each interval's analysis to a CSV file specified in the features.conf file. In each row, the values are: PID, average power in this interval in Watts, and energy consumed in Joules in this interval.

Example 2: Analyze the Chrome Application

To analyze the Chrome application (all its PIDs) at an interval of 1000 milliseconds indefinitely (t is a negative number) until the user presses Ctrl+C for the GPU, use the following command:

./floc --gpu -n chrome -i 1000 -t -1 -d

Note that the -d option makes EcoFloc continue running even if chrome is closed. When this happens, EcoFloc will wait until Chrome is reopened.

This command will output the results in the console in the following format:

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

References

[^1]: [Têchnopole Domolandes](https://www.domolandes.fr [^2]: Running Average Power Limit (RAPL): Intel® 64 and IA-32 Architectures Software Developer's Manual, specifically in the section detailing power and thermal management. [^3]: 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)