Stopwatch

class thread_factory.utilities.timing_tools.stopwatch.Stopwatch[source]

Bases: IDisposable

Features:
  • Start / Stop / Reset / Elapsed time

  • Thread-safe for use in concurrent applications

dispose()[source]

Dispose of internal state. Frees stopwatch references.

elapsed() float[source]

Returns the total elapsed time in seconds without stopping the stopwatch.

Returns:

The current elapsed time in seconds.

Return type:

float

is_running() bool[source]

Returns whether the stopwatch is currently running.

Returns:

True if running, False if stopped.

Return type:

bool

reset()[source]

Reset the stopwatch to zero. Stops the stopwatch if running.

start()[source]

Start or resume the stopwatch. Does nothing if already running.

stop()[source]

Stop the stopwatch and accumulate elapsed time.