summaryrefslogtreecommitdiff
path: root/eventlet/debug.py
diff options
context:
space:
mode:
authorRyan Williams <rdw@lindenlab.com>2010-02-13 15:30:03 -0800
committerRyan Williams <rdw@lindenlab.com>2010-02-13 15:30:03 -0800
commit695159bdb1521f474d6532e9ecadd1dd4b85629d (patch)
tree41aaf865bed5765fc82d68728b55d78deed8e6cf /eventlet/debug.py
parentc0e6b2e18ee7adbdb97c82c78fe6d0a68615af04 (diff)
downloadeventlet-695159bdb1521f474d6532e9ecadd1dd4b85629d.tar.gz
Added spawn_after, with tests and documentation. Removed dead code in timer_test.
Diffstat (limited to 'eventlet/debug.py')
-rw-r--r--eventlet/debug.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/eventlet/debug.py b/eventlet/debug.py
index 7db7f82..a850232 100644
--- a/eventlet/debug.py
+++ b/eventlet/debug.py
@@ -77,6 +77,18 @@ def format_hub_listeners():
for l in hub.get_writers():
result.append(repr(l))
return os.linesep.join(result)
+
+def format_hub_timers():
+ """ Returns a formatted string of the current timers on the current
+ hub. This can be useful in determining what's going on in the event system,
+ especially when used in conjunction with :func:`hub_timer_stacks`.
+ """
+ from eventlet import hubs
+ hub = hubs.get_hub()
+ result = ['TIMERS:']
+ for l in hub.timers:
+ result.append(repr(l))
+ return os.linesep.join(result)
def hub_listener_stacks(state):
"""Toggles whether or not the hub records the stack when clients register
@@ -88,6 +100,14 @@ def hub_listener_stacks(state):
from eventlet import hubs
hubs.get_hub().set_debug_listeners(state)
+def hub_timer_stacks(state):
+ """Toggles whether or not the hub records the stack when timers are set.
+ To inspect the stacks of the current timers, call :func:`format_hub_timers`
+ at critical junctures in the application logic.
+ """
+ from eventlet import timer
+ timer._g_debug = state
+
def hub_exceptions(state):
"""Toggles whether the hub prints exceptions that are raised from its
timers. This can be useful to see how greenthreads are terminating.