powerapi-ng / pyRAPL

a library to measure the python energy consumption of python code
MIT License
100 stars 9 forks source link

@pyRAPL.measure in demo code returns error: AttributeError: module 'pyRAPL' has no attribute 'measure' #14

Open stephbuon opened 2 years ago

stephbuon commented 2 years ago

Hi,

When I try your demo code (from PyPI and this repo):

import pyRAPL

pyRAPL.setup() 

@pyRAPL.measure
def foo():
        # Instructions to be evaluated.

    foo()

I get an attribute error: AttributeError: module 'pyRAPL' has no attribute 'measure'.

Can I please request guidance?

Thank you! Steph

adhooge commented 2 years ago

Hi!

I hope you solved your problem since you asked but I'll answer anyway to others who might have the same problem. It appears the README on the repo is not up to date (or just incorrect). The actual decorator to use is @pyRAPL.measureit, as described in the docs: https://pyrapl.readthedocs.io/en/latest/quickstart.html

It solved the problem for me.