pymor.tools.timing
¶
Module Contents¶
Classes¶
Class for finding code runtime. |
Functions¶
- 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)