pymor.tools.timing

Module Contents

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)

Methods

start

stop

start(self)[source]
stop(self)[source]
pymor.tools.timing.busywait(amount)[source]