Skip to content

Commit

Permalink
update : doccumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
chakib-belgaid committed Oct 21, 2019
1 parent 138903f commit 6ef3ea0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ By default, **pyRAPL** monitors all the available devices of the machine's socke

You can append the device `pyRAPL.Device.DRAM` to the `devices` parameter list to monitor RAM device too.

## Running the test multiple times

For short functions, you can configure the number of runs and it will calculate the mean energy consumption of all runs.
As an example if you want to run the test 100 times :

import pyRAPL

pyRAPL.setup()


@pyRAPL.measure(number=100)
def fun():
# Some stuff ...

for _ in range(100):
fun()


## Configure the output of the decorator

If you want to handle data with different output than the standard one, you can configure the decorator with an `Output` instance from the `pyRAPL.outputs` module.
Expand All @@ -77,7 +95,7 @@ As an example if you want to write the recorded energy consumption in a csv file
for _ in range(100):
fun()
csv_output.save()
csv_output.save()

This will produce a csv file of 100 lines. Each line containing the energy
consumption recorded during one execution of the function `fun`.
Expand Down
19 changes: 19 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ By default, **pyRAPL** monitors all the available devices of the machine's socke

You can append the device ``pyRAPL.Device.DRAM`` to the ``devices`` parameter list to monitor RAM device too.

Running the test multiple times
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For short functions, you can configure the number of runs and it will calculate the mean energy consumption of all runs.
As an example if you want to run the test 100 times :

import pyRAPL

pyRAPL.setup()


@pyRAPL.measure(number=100)
def fun():
# Some stuff ...

for _ in range(100):
fun()


Configure the output of the decorator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion pyRAPL/measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def result(self) -> Result:

def measureit(_func=None, *, output: Output = None, number: int = 1):
"""
Measure the energy consumption of monitored devices during the execution of the decorated function
Measure the energy consumption of monitored devices during the execution of the decorated function (if multiple runs it will measure the mean energy)
:param output: output instance that will receive the power consummation data
:param number: number of iteration in the loop in case you need multiple runs or the code is too fast to be measured
Expand Down

0 comments on commit 6ef3ea0

Please sign in to comment.