Skip to content

Commit 6ef3ea0

Browse files
update : doccumentation
1 parent 138903f commit 6ef3ea0

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,24 @@ By default, **pyRAPL** monitors all the available devices of the machine's socke
5757

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

60+
## Running the test multiple times
61+
62+
For short functions, you can configure the number of runs and it will calculate the mean energy consumption of all runs.
63+
As an example if you want to run the test 100 times :
64+
65+
import pyRAPL
66+
67+
pyRAPL.setup()
68+
69+
70+
@pyRAPL.measure(number=100)
71+
def fun():
72+
# Some stuff ...
73+
74+
for _ in range(100):
75+
fun()
76+
77+
6078
## Configure the output of the decorator
6179

6280
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.
@@ -77,7 +95,7 @@ As an example if you want to write the recorded energy consumption in a csv file
7795
for _ in range(100):
7896
fun()
7997
80-
csv_output.save()
98+
csv_output.save()
8199

82100
This will produce a csv file of 100 lines. Each line containing the energy
83101
consumption recorded during one execution of the function `fun`.

docs/quickstart.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ By default, **pyRAPL** monitors all the available devices of the machine's socke
4949

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

52+
Running the test multiple times
53+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
55+
For short functions, you can configure the number of runs and it will calculate the mean energy consumption of all runs.
56+
As an example if you want to run the test 100 times :
57+
58+
import pyRAPL
59+
60+
pyRAPL.setup()
61+
62+
63+
@pyRAPL.measure(number=100)
64+
def fun():
65+
# Some stuff ...
66+
67+
for _ in range(100):
68+
fun()
69+
70+
5271
Configure the output of the decorator
5372
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5473

pyRAPL/measurement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def result(self) -> Result:
9696

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

0 commit comments

Comments
 (0)