pymor.tools.timing

Module Contents

Classes

Timer

Class for finding code runtime.

Functions

busywait

class pymor.tools.timing.Timer(section, log=getLogger(__name__))[source]

Class for finding code runtime.

You can use me as a context manager, plain instance or decorator to time execution of a code scope:

with Timer() as timer:
    do_some_stuff()
    do more stuff()
#outputs time in (s)

### OR ###

@timing.Timer('name', logging.debug)
def function(*args):
    do_stuff

function(1)
#outputs time in (s) to logging.debug

### OR ###

timer = timing.Timer()
timer.start()
do_stuff()
timer.stop()
print(timer.dt)
start(self)[source]
stop(self)[source]
__enter__(self)[source]
__exit__(self, type_, value, traceback)[source]
__call__(self, func)[source]
pymor.tools.timing.busywait(amount)[source]