powerapi-ng / pyJoules

A Python library to capture the energy consumption of code snippets
MIT License
69 stars 8 forks source link

Understanding the output of pyJoules #6

Closed danglotb closed 3 years ago

danglotb commented 4 years ago

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.

altor commented 4 years ago

decorator basic usage will print information with this format :

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

with :

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)

danglotb commented 4 years ago

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,

altor commented 4 years ago

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

danglotb commented 4 years ago

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

altor commented 4 years ago

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