powerapi-ng / pyJoules

A Python library to capture the energy consumption of code snippets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Understanding the output of pyJoules

danglotb opened this issue · comments

Hello, I did succeed to run pyJoules on small examples.

However, I'm a bit confused about the output. Would you mind explaining what are the fields, their units, and how there are measured? If there is any reference that I should read, please could provide me a pointer or something likewise?

Toy python script used:

from pyJoules.energy_meter import measureit
import sys

@measureit
def fib(n,x=[0,1]):
    for i in range(abs(n)-1): 
        x=[x[1],sum(x)]
    return x[1]*pow(-1,abs(n)-1) if n<0 else x[1] if n else 0

print(fib(int(sys.argv[1])))

Output:

begin timestamp : 1599722530834595361; tag : fib; duration : 656476; package_0 : 0.0; dram_0 : 0.0; core_0 : 6531.0; uncore_0 : 0.0

Thank you very much.

decorator basic usage will print information with this format :

begin timestamp : XXX; tag : YYY; duration : ZZZ;device_name: AAAA

with :

  • begin timestamp : monitored function launching time
  • tag: tag of the measure, if nothing is specified, this will be the function name
  • duration: function execution duration
  • device_name: energy consumption of the device device_name in uJ

for cpu and ram devices, device_name match the RAPL domain described on the image below. The id match the CPU socket id :

For the energy null values this append when the function execution duration is smaller than the energy measurement frequency

(I will had this information on the README.md)

Hello @altor,

That's a very nice diagram! Thank you very much for your support.

Do you know how to compute a human-readable date from begin timestamp?
Is the duration measured in ms?

Best,

Yes duration are in ms. For handle timstamp in python use the datetime module

Thank you very much @altor

The documentation refers to a MongoDB handler for the output:

Other predefined Handler classes exist to export data to MongoDB and Panda dataframe.

Unfortunately, I could not find it in this repository. Does it exist somewhere else?

Thank you very much! All the Best

Hi,
These features are under development, i can plan them for this week
I'll keep you informed