openmmtools.utils.Timer

class openmmtools.utils.Timer[source]

A class with stopwatch-style timing functions.

Examples

>>> timer = Timer()
>>> timer.start('my benchmark')
>>> for i in range(10):
...     pass
>>> elapsed_time = timer.stop('my benchmark')
>>> timer.start('second benchmark')
>>> for i in range(10):
...     for j in range(10):
...         pass
>>> elsapsed_time = timer.stop('second benchmark')
>>> timer.report_timing()

Methods

partial(benchmark_id)

Return the elapsed time of the given benchmark so far.

report_timing([clear])

Log all the timings at the debug level.

reset_timing_statistics([benchmark_id])

Reset the timing statistics.

start(benchmark_id)

Start a timer with given benchmark_id.

stop

__init__()[source]

Methods

__init__()

partial(benchmark_id)

Return the elapsed time of the given benchmark so far.

report_timing([clear])

Log all the timings at the debug level.

reset_timing_statistics([benchmark_id])

Reset the timing statistics.

start(benchmark_id)

Start a timer with given benchmark_id.

stop(benchmark_id)