biogeme.tools.time module

class biogeme.tools.time.Timing(warm_up_runs=10, num_runs=100)[source]

Bases: object

Call for timing the execution of callable functions

Parameters:
  • warm_up_runs (int)

  • num_runs (int)

property num_runs: int
time_function(callable_func, kwargs)[source]

Times the execution of a callable function, excluding the warm-up period.

Parameters:
  • callable_func (Callable) – The function to be timed.

  • kwargs (dict[str, Any]) – Dictionary of keyword arguments to pass to the function. Note that all arguments must be with keyword

Return type:

float

Returns:

Average time per run.

property warm_up_runs: int
biogeme.tools.time.format_timedelta(td)[source]

Format a timedelta in a “human-readable” way

Return type:

str

Parameters:

td (timedelta)