Skip to content

Export Citation

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 = {},
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 = {},
HAL_ID = {hal-04601379},

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).