Run
Last Updated: v1.5
A module to store information about time, also works out calculations about time.
from PythonFunctions import Run
Mark
- Mark(name)
Adds a new marker
- Parameters
name (str) – (Optional) name to give the marker
- Returns
The marker index
- Return type
int
index = Run.Mark()
print(index)
GetMarkTime
- GetMarkTime(name)
Get the time that mark X has
- Parameters
name (str) – The marker index to get the time of
- Returns
The time at that point
- Return type
float
time = Run.GetMarkTime(index)
print(time)
CompareMarkers
- CompareIndex(a, b, roundVale)
Compare the marked times between a and b
- Parameters
a (int) – The first marker
b (int) – The second marker
roundValue (int) – (Optional), How many decimal places to round to. Defaults to -1 (none)
- Returns
The time difference
- Return type
float
- Raises
IndexError – One of the provided markers was not in range of all of the markers
# Get two different times
a = Run.Mark()
time.sleep(1)
b = Run.Mark()
# Compare
dif = Run.CompareIndex(a, b)
print(diff)
End
- End()
Return the amount of time has passed sinces the file got imported (started)
- Returns
Amount of time passed
- Return type
float
print(Run.End())
Timer
Note
This is not used like the other functions.
The purpose of this is to check how long it takes a function to run. To use it follow the code below.
@Run.Timer
def test():
print('a')
time.sleep(1)
print('b')
This above code will print off a and b and the time it took. (test took X seconds).