Timer¶
-
class
vindinium.utils.Timer(do_print=False)[source]¶ Bases:
objectTimer helper.
A timer object helps to verify how much time has been taken to execute some code.
Example
You can use this class in two ways. First as a with statement:
with Timer() as timer: # your code here print timer.elapsedNotice that you can pass
Trueas argument to Timer in order to allow it to print the elapsed time when the with finishes.Alternatively, you can use Timer like the tic toc functions of Matlab:
timer = Timer() timer.tic() # your code here print timer.toc()
-
elapsed¶ float
the elapsed time between
tic()andtoc().
-