powerapi-ng / pyJoules

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

Remove IDLE from energy sample #10

Closed danglotb closed 3 years ago

danglotb commented 3 years ago

Hello,

I could read in the README:

Here are some basic usages of pyJoules. Please note that the reported energy consumption is not only the energy consumption of the code you are running. This includes the global energy consumption of all the process running on the machine during this period, thus including the operating system and other applications. That is why we recommend to eliminate any extra programs that may alter the energy consumption of the machine hosting experiments and to keep only the code under measurement (i.e., no extra applications, such as graphical interface, background running task...). This will give the closest measure to the real energy consumption of the measured code.

However, while browsing the source code of pyJoules, I found the function remove_idle.

Does this function remove the idle period of the process that we want to measure? Or this function does something else which is not related to the mentioned excerpt of the documentation?

Thank you very much!

Best

altor commented 3 years ago

Hello, Yes remove_idle could be used to remove idle consumption of a trace. The idle consumption is computed by the gen_idle method by measuring energy consumption of an empty workload with a duration equals to the trace duration.

Currently this feature is not accessible from decorator and context manager but I will integrate it soon !

danglotb commented 3 years ago

Hello @altor

Thank you very much for your precious feedback.

Best,