[Python-checkins] cpython: Issue #20505: use also the monotonic time to decide if asyncio debug traces

victor.stinner python-checkins at python.org
Tue Feb 11 10:29:03 CET 2014


http://hg.python.org/cpython/rev/a631b01d1715
changeset:   89144:a631b01d1715
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Feb 11 10:26:53 2014 +0100
summary:
  Issue #20505: use also the monotonic time to decide if asyncio debug traces
should be printed

files:
  Lib/asyncio/base_events.py |  7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -639,15 +639,16 @@
             event_list = self._selector.select(timeout)
             dt = time.perf_counter() - t0
             dt_monotonic = time.monotonic() - t0_monotonic
-            if not event_list and timeout and dt < timeout:
+            if (not event_list and timeout
+            and (dt < timeout or dt_monotonic < timeout)):
                 selector = self._selector.__class__.__name__
                 if (selector.startswith(("Poll", "Epoll", "Iocp"))
                 or timeout > 1e-3 or dt > 1e-3):
                     unit, factor = "ms", 1e3
                 else:
                     unit, factor = "us", 1e6
-                print("asyncio: %s.select(%.3f %s) took %.3f %s"
-                      " (monotonic: %.3f %s, clock res: %.3f %s)"
+                print("asyncio: %s.select(%.4f %s) took %.3f %s"
+                      " (monotonic=%.3f %s, clock res=%.3f %s)"
                       % (self._selector.__class__.__name__,
                          timeout * factor, unit,
                          dt * factor, unit,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list