Skip to content

Export Citation

        
          
@article{fieni-2024,
TITLE = {{PowerAPI: A Python framework for building software-defined power meters}},
AUTHOR = {Fieni, Guillaume and Acero, Daniel Romero and Rust, Pierre and Rouvoy, Romain},
URL = {https://hal.science/hal-04601379},
JOURNAL = {{Journal of Open Source Software}},
PUBLISHER = {{Open Journals}},
VOLUME = {9},
NUMBER = {98},
PAGES = {6670},
YEAR = {2024},
MONTH = Jun,
DOI = {10.21105/joss.06670},
KEYWORDS = {Power ; Energy ; Toolkit ; Measurement ; Framework},
PDF = {https://hal.science/hal-04601379/file/10.21105.joss.06670-3.pdf},
HAL_ID = {hal-04601379},
HAL_VERSION = {v1},
}
          
          
              
      

How to create a cgroup

If you want to monitor a specific process (or group of process) with cgroup V1, you have to create a cgroup with perf_event controller and add the process you want to monitor to this cgroup.

You can easly do this with the following command :

  • To create the cgroup:
cgcreate -g perf_event:new_cgroup_name

with new_cgroup_name the name of the cgroup you want to create (this will be the name wich will identify power consumption of you process).

  • To add your process to the newly created cgroup:
cgclassify -g perf_event:new_cgroup_name PID

with PID, the pid of the process you want to monitor. If you want to monitor a program composed of many process, replace PID with $(pidof program_name).