diff --git a/adaptive/runner.py b/adaptive/runner.py index 1f79346716916fd6a6b66e6d901830e2de14432f..44fba35d22ed2810f0a464092ba492ca82a3bbfb 100644 --- a/adaptive/runner.py +++ b/adaptive/runner.py @@ -180,6 +180,10 @@ class BaseRunner(metaclass=abc.ABCMeta): but is a rough rule of thumb. """ t_function = self._elapsed_function_time + if t_function == 0: + # When no function is done executing, the overhead cannot + # reliably be determined, so 0 is the best we can do. + return 0 t_total = self.elapsed_time() return (1 - t_function / t_total) * 100 @@ -426,7 +430,6 @@ class AsyncRunner(BaseRunner): overhead of the executor. Essentially, this is ``100 * (1 - total_elapsed_function_time / self.elapsed_time())``. - Notes ----- This runner can be used when an async function (defined with