Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes
MoinMoin.util.thread_monitor.LegacyMonitor Class Reference
Inheritance diagram for MoinMoin.util.thread_monitor.LegacyMonitor:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.util.thread_monitor.LegacyMonitor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def dump
def dump_hook
def trigger_dump
def activate_hook
def hook_enabled

Static Public Attributes

 dumping = False
 dump_file = None
tuple dumped = set()
tuple to_dump = set()
 hook_enabled = False
tuple dump = classmethod(dump)
tuple dump_hook = classmethod(dump_hook)
tuple trigger_dump = classmethod(trigger_dump)
tuple activate_hook = classmethod(activate_hook)
tuple hook_enabled = classmethod(hook_enabled)

Detailed Description

Definition at line 44 of file thread_monitor.py.


Member Function Documentation

Activates the thread monitor hook. Note that this might interfere
with any kind of profiler and some debugging extensions. 

Reimplemented from MoinMoin.util.thread_monitor.AbstractMonitor.

Definition at line 82 of file thread_monitor.py.

00082 
00083     def activate_hook(cls):
00084         sys.setprofile(cls.dump_hook)
00085         threading.setprofile(cls.dump_hook)
        cls.hook_enabled = True

Definition at line 52 of file thread_monitor.py.

00052 
00053     def dump(cls, label):
00054         df = cls.dump_file or sys.stderr
00055         s = StringIO()
00056         print >>s, "\nDumping thread %s:" % (label, )
00057         try:
00058             raise ZeroDivisionError
00059         except ZeroDivisionError:
00060             f = sys.exc_info()[2].tb_frame.f_back.f_back
00061         traceback.print_list(traceback.extract_stack(f, None), s)
        df.write(s.getvalue())
def MoinMoin.util.thread_monitor.LegacyMonitor.dump_hook (   cls,
  a,
  b,
  c 
)

Definition at line 64 of file thread_monitor.py.

00064 
00065     def dump_hook(cls, a, b, c): # arguments are ignored
00066         if cls.dumping and sys.exc_info()[0] is None:
00067             thread = threading.currentThread()
00068             if thread in cls.to_dump:
00069                 cls.dump(repr(thread))
00070                 cls.to_dump.discard(thread)
00071                 cls.dumped.add(thread)
00072                 if not cls.to_dump:
                    cls.dumping = False
Returns true if the thread_monitor hook is enabled. 

Reimplemented from MoinMoin.util.thread_monitor.AbstractMonitor.

Definition at line 88 of file thread_monitor.py.

00088 
00089     def hook_enabled(cls):
        return cls.hook_enabled
def MoinMoin.util.thread_monitor.LegacyMonitor.trigger_dump (   self,
  dumpfile = None 
)
Triggers the dump of the tracebacks of all threads.
    If dumpfile is specified, it is used as the output file. 

Reimplemented from MoinMoin.util.thread_monitor.AbstractMonitor.

Definition at line 75 of file thread_monitor.py.

00075 
00076     def trigger_dump(cls, dumpfile=None):
00077         cls.to_dump = set(threading.enumerate())
00078         if dumpfile is not None:
00079             cls.dump_file = dumpfile
        cls.dumping = True

Member Data Documentation

Definition at line 86 of file thread_monitor.py.

Definition at line 62 of file thread_monitor.py.

Definition at line 47 of file thread_monitor.py.

Definition at line 73 of file thread_monitor.py.

Definition at line 48 of file thread_monitor.py.

Definition at line 46 of file thread_monitor.py.

Definition at line 50 of file thread_monitor.py.

Definition at line 90 of file thread_monitor.py.

Definition at line 49 of file thread_monitor.py.

Definition at line 80 of file thread_monitor.py.


The documentation for this class was generated from the following file: