annotate MoinMoin/util/thread_monitor.py @ 6103:500f68d3e2fd

remove our own usage of python_compatibility module
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 06 Sep 2016 01:00:25 +0200
parents 5e7b45489430
children
rev   line source
712
6ff5221f7e18 Made thread_monitor 8bit clean and added epydoc formatting.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 674
diff changeset
1 # -*- coding: ascii -*-
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
2 """
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1870
diff changeset
3 Thread monitor - Check the state of all threads.
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1870
diff changeset
5 Just call activate_hook() as early as possible in program execution.
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1870
diff changeset
6 Then you can trigger the output of tracebacks of all threads
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1870
diff changeset
7 by calling trigger_dump().
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
8
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1870
diff changeset
9 Usage of Python 2.5 is recommended because it allows for a much safer
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1870
diff changeset
10 and faster frame extraction.
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
11
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1870
diff changeset
12 @copyright: 2006 Alexander Schremmer <alex AT alexanderweb DOT de>
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1870
diff changeset
13 @license: GNU GPL Version 2
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
14 """
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
15
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
16
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
17 __all__ = "activate_hook trigger_dump dump_regularly".split()
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
18
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
19
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
20 import sys
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
21 import threading
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
22 import traceback
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
23 from time import sleep
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
24 from StringIO import StringIO
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
25
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
26
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
27 class AbstractMonitor(object):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
28 def activate_hook(self):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
29 """ Activates the thread monitor hook. Note that this might interfere
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
30 with any kind of profiler and some debugging extensions. """
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
31 raise NotImplementedError
1004
7828d27399d4 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 835
diff changeset
32
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
33 def trigger_dump(self, dumpfile=None):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
34 """ Triggers the dump of the tracebacks of all threads.
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
35 If dumpfile is specified, it is used as the output file. """
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
36 raise NotImplementedError
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
37
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
38 def hook_enabled(self):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
39 """ Returns true if the thread_monitor hook is enabled. """
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
40 raise NotImplementedError
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
41
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
42 class LegacyMonitor(AbstractMonitor):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
43 # global state
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
44 dumping = False
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
45 dump_file = None
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
46 dumped = set()
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
47 to_dump = set()
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
48 hook_enabled = False
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
49
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
50 def dump(cls, label):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
51 df = cls.dump_file or sys.stderr
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
52 s = StringIO()
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
53 print >>s, "\nDumping thread %s:" % (label, )
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
54 try:
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
55 raise ZeroDivisionError
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
56 except ZeroDivisionError:
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
57 f = sys.exc_info()[2].tb_frame.f_back.f_back
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
58 traceback.print_list(traceback.extract_stack(f, None), s)
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
59 df.write(s.getvalue())
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
60 dump = classmethod(dump)
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
61
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
62 def dump_hook(cls, a, b, c): # arguments are ignored
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
63 if cls.dumping and sys.exc_info()[0] is None:
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
64 thread = threading.currentThread()
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
65 if thread in cls.to_dump:
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
66 cls.dump(repr(thread))
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
67 cls.to_dump.discard(thread)
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
68 cls.dumped.add(thread)
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
69 if not cls.to_dump:
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
70 cls.dumping = False
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
71 dump_hook = classmethod(dump_hook)
1004
7828d27399d4 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 835
diff changeset
72
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
73 def trigger_dump(cls, dumpfile=None):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
74 cls.to_dump = set(threading.enumerate())
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
75 if dumpfile is not None:
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
76 cls.dump_file = dumpfile
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
77 cls.dumping = True
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
78 trigger_dump = classmethod(trigger_dump)
2286
01f05e74aa9c Big PEP8 and whitespace cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
79
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
80 def activate_hook(cls):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
81 sys.setprofile(cls.dump_hook)
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
82 threading.setprofile(cls.dump_hook)
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
83 cls.hook_enabled = True
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
84 activate_hook = classmethod(activate_hook)
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
85
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
86 def hook_enabled(cls):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
87 return cls.hook_enabled
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
88 hook_enabled = classmethod(hook_enabled)
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
89
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
90
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
91 class DirectMonitor(AbstractMonitor):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
92 def __init__(self):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
93 self.enabled = False
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
94 assert hasattr(sys, "_current_frames")
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
95
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
96 def activate_hook(self):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
97 self.enabled = True
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
98
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
99 def trigger_dump(self, dumpfile=None):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
100 if not self.enabled:
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
101 return
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
102 dumpfile = dumpfile or sys.stderr
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
103 cur_frames = sys._current_frames()
1870
9406e02388cf reduce usage of .keys()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1528
diff changeset
104 for i in cur_frames:
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
105 s = StringIO()
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
106 print >>s, "\nDumping thread (id %s):" % (i, )
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
107 traceback.print_stack(cur_frames[i], file=s)
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
108 dumpfile.write(s.getvalue())
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
109
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
110 def hook_enabled(self):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
111 return self.enabled
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
112
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
113
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
114 def dump_regularly(seconds):
712
6ff5221f7e18 Made thread_monitor 8bit clean and added epydoc formatting.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 674
diff changeset
115 """ Dumps the tracebacks every 'seconds' seconds. """
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
116 activate_hook()
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
117
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
118 def background_dumper(seconds):
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
119 while 1:
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
120 sleep(seconds)
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
121 trigger_dump()
1004
7828d27399d4 whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 835
diff changeset
122
674
b4a6bad53f91 Added thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
diff changeset
123 threading.Thread(target=background_dumper, args=(seconds, )).start()
835
d4dd4fca1477 moved action/tm to action/thread_monitor, minor cleanup, added CHANGES entry about thread_monitor action
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 712
diff changeset
124
1528
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
125
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
126 # Python 2.5 provides an optimised version
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
127 if hasattr(sys, "_current_frames"):
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
128 mon = DirectMonitor()
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
129 else:
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
130 mon = LegacyMonitor()
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
131
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
132 activate_hook = mon.activate_hook
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
133 trigger_dump = mon.trigger_dump
ec52fba7f971 Added support for Python 2.5 in the thread monitor.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1004
diff changeset
134 hook_enabled = mon.hook_enabled