Timer

final class tifffile.Timer(message=None, *, end=' ', started=None)

Stopwatch for timing execution speed.

Parameters:
  • message (str | None) – Message to print.

  • end (str) – End of print statement.

  • started (float) – Value of performance counter when started. The default is the current performance counter.

Examples

>>> with Timer('sleep:'):
...     time.sleep(1.05)
sleep: 1.0... s
duration: float

Duration between started and stopped in seconds.

started: float

Value of performance counter when started.

stopped: float

Value of performance counter when stopped.

start(message=None, *, end=' ')

Start timer and return current time.

Parameters:
  • message (str | None)

  • end (str)

Return type:

float

stop(message=None, *, end=' ')

Return duration of timer till start.

Parameters:
  • message (str | None) – Message to print.

  • end (str) – End of print statement.

Return type:

float

print(message=None, *, end=None)

Print duration from timer start till last stop or now.

Parameters:
  • message (str | None) – Message to print.

  • end (str | None) – End of print statement.

Return type:

None

static clock()

Return value of performance counter.

Return type:

float