Skip to content

mezzeddinee/PerProcessSimplePowerEstimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Per-Process Energy Estimation

This script estimates per-process CPU energy consumption over a sampling interval using Linux RAPL counters and CPU time attribution, similar to how Scaphandre operates.


✅ How It Works

  1. Read total CPU energy from (energy_uj)
  2. Take a snapshot of per-process CPU times
  3. Sleep for a short interval
  4. Take another energy + CPU snapshot
  5. Attribute total energy to each process based on CPU time share

✅ Formula Used

For each process:

[ E_\text{process} = \left( \frac{\Delta T_\text{process}}{\sum \Delta T_\text{all processes}} \right) \times \Delta E_\text{total} ]

Where:

  • ( \Delta T_\text{process} ) = Increase in CPU time (user + system) during the interval
  • ( \sum \Delta T_\text{all processes} ) = Sum of CPU time increases for all processes
  • ( \Delta E_\text{total} ) = Energy difference from RAPL over the interval
  • Energy is in microjoules (µJ)

✅ Requirements

  • Linux machine
  • CPU with RAPL support (Intel / some AMD)
  • Python 3
  • sudo permissions
  • psutil installed

Install psutil one of these ways:

Option 1 (system package):

sudo apt install python3-psutil

About

Estimate the power of a process

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages