mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #20505: use also the monotonic time to decide if asyncio debug traces
should be printed
This commit is contained in:
parent
5d1ea04b06
commit
1db2ba3a92
1 changed files with 4 additions and 3 deletions
|
@ -639,15 +639,16 @@ class BaseEventLoop(events.AbstractEventLoop):
|
||||||
event_list = self._selector.select(timeout)
|
event_list = self._selector.select(timeout)
|
||||||
dt = time.perf_counter() - t0
|
dt = time.perf_counter() - t0
|
||||||
dt_monotonic = time.monotonic() - t0_monotonic
|
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__
|
selector = self._selector.__class__.__name__
|
||||||
if (selector.startswith(("Poll", "Epoll", "Iocp"))
|
if (selector.startswith(("Poll", "Epoll", "Iocp"))
|
||||||
or timeout > 1e-3 or dt > 1e-3):
|
or timeout > 1e-3 or dt > 1e-3):
|
||||||
unit, factor = "ms", 1e3
|
unit, factor = "ms", 1e3
|
||||||
else:
|
else:
|
||||||
unit, factor = "us", 1e6
|
unit, factor = "us", 1e6
|
||||||
print("asyncio: %s.select(%.3f %s) took %.3f %s"
|
print("asyncio: %s.select(%.4f %s) took %.3f %s"
|
||||||
" (monotonic: %.3f %s, clock res: %.3f %s)"
|
" (monotonic=%.3f %s, clock res=%.3f %s)"
|
||||||
% (self._selector.__class__.__name__,
|
% (self._selector.__class__.__name__,
|
||||||
timeout * factor, unit,
|
timeout * factor, unit,
|
||||||
dt * factor, unit,
|
dt * factor, unit,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue