[Python-checkins] cpython: Issue #20505: add debug info

victor.stinner python-checkins at python.org
Fri Feb 7 17:57:59 CET 2014


http://hg.python.org/cpython/rev/3b94a4ef244e
changeset:   89015:3b94a4ef244e
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Feb 07 17:53:13 2014 +0100
summary:
  Issue #20505: add debug info

files:
  Lib/asyncio/base_events.py |  10 ++++++++++
  1 files changed, 10 insertions(+), 0 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
@@ -634,7 +634,17 @@
             else:
                 logger.log(level, 'poll took %.3f seconds', t1-t0)
         else:
+            t0 = self.time()
             event_list = self._selector.select(timeout)
+            dt = self.time() - t0
+            if timeout and not event_list and dt < timeout:
+                print("%s.select(%.3f ms) took %.3f ms (granularity=%.3f ms, resolution=%.3f ms)"
+                      % (self._selector.__class__.__name__,
+                         timeout * 1e3,
+                         dt * 1e3,
+                         self._granularity * 1e3,
+                         self._selector.resolution * 1e3),
+                      file=sys.__stderr__)
         self._process_events(event_list)
 
         # Handle 'later' callbacks that are ready.

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


More information about the Python-checkins mailing list