Implements the TimerWithMaxTime class used for checking the ‘max_runtime’ is not exceeded.
- class fitbenchmarking.utils.timer.TimerWithMaxTime(max_runtime: float)
A timer class used for checking if the ‘max_runtime’ is exceeded when executing the fits.
- check_elapsed_time() None
Checks whether the max runtime has been exceeded. Raises a MaxRuntimeError exception if it has been exceeded. Otherwise, it carries on.
- reset() None
Resets the timer so it can be used for timing a different fit combination.
- start() None
Starts the timer by recording the current time.
- stop() None
Stops the timer if it is timing something. The elapsed time since starting the timer is added onto the total elapsed time.