Index: tools/telemetry/telemetry/core/util.py |
diff --git a/tools/telemetry/telemetry/core/util.py b/tools/telemetry/telemetry/core/util.py |
index 460eb61ec7fb42bd131ac891b96af6769eaaeef3..5d666e4318ccc536261bbdaa2910c2501e607279 100644 |
--- a/tools/telemetry/telemetry/core/util.py |
+++ b/tools/telemetry/telemetry/core/util.py |
@@ -50,10 +50,11 @@ def GetPythonPageSetModule(file_path): |
return imp.load_source(_GetUniqueModuleName(), file_path) |
-def WaitFor(condition, timeout): |
+def WaitFor(condition, timeout, fixed_poll_interval=None): |
"""Waits for up to |timeout| secs for the function |condition| to return True. |
- Polling frequency is (elapsed_time / 10), with a min of .1s and max of 5s. |
+ Polling interval is (elapsed_time / 10), with a min of .1s and max of 5s, |
+ unless |fixed_poll_interval| is specified. |
Returns: |
Result of |condition| function (if present). |
@@ -86,7 +87,8 @@ def WaitFor(condition, timeout): |
logging.info('Continuing to wait %ds for %s. Elapsed: %ds.', |
timeout, GetConditionString(), elapsed_time) |
last_output_time = time.time() |
- poll_interval = min(max(elapsed_time / 10., min_poll_interval), |
+ poll_interval = fixed_poll_interval or \ |
+ min(max(elapsed_time / 10., min_poll_interval), |
max_poll_interval) |
time.sleep(poll_interval) |