Tictoc

class pyvsim.Utils.Tictoc[source]

Just something simpler than the timeit from Python (and more Matlab-style)

Methods

tic()[source]

Resets the timer, must be used at the before each timed method >>> tic = Tictoc() >>> tic.tic()

toc(n=None)[source]

Gives the calculation time or speed, depending if the number of calculations executed from the last reset is provided as the input n.

>>> tic = Tictoc()
>>> tic.tic()
>>> tic.toc() 
Elapsed time: ...
...

or

>>> tic = Tictoc()
>>> tic.tic()
>>> tic.toc(10) 
Can execute: ... calculations / second
...

This Page