Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_sys_setprofile.ProfileSimulator Class Reference
Inheritance diagram for test.test_sys_setprofile.ProfileSimulator:
Inheritance graph
[legend]
Collaboration diagram for test.test_sys_setprofile.ProfileSimulator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def callback
def trace_call
def trace_return
def trace_exception
def trace_pass
def add_event
def get_events

Public Attributes

 testcase
 stack
 frames
 events

Static Public Attributes

dictionary dispatch

Detailed Description

Definition at line 57 of file test_sys_setprofile.py.


Constructor & Destructor Documentation

Definition at line 58 of file test_sys_setprofile.py.

00058 
00059     def __init__(self, testcase):
00060         self.testcase = testcase
00061         self.stack = []
00062         HookWatcher.__init__(self)

Here is the caller graph for this function:


Member Function Documentation

def test.test_sys_setprofile.HookWatcher.add_event (   self,
  event,
  frame = None 
) [inherited]
Add an event to the log.

Definition at line 36 of file test_sys_setprofile.py.

00036 
00037     def add_event(self, event, frame=None):
00038         """Add an event to the log."""
00039         if frame is None:
00040             frame = sys._getframe(1)
00041 
00042         try:
00043             frameno = self.frames.index(frame)
00044         except ValueError:
00045             frameno = len(self.frames)
00046             self.frames.append(frame)
00047 
00048         self.events.append((frameno, event, ident(frame)))

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_sys_setprofile.ProfileSimulator.callback (   self,
  frame,
  event,
  arg 
)

Reimplemented from test.test_sys_setprofile.HookWatcher.

Definition at line 63 of file test_sys_setprofile.py.

00063 
00064     def callback(self, frame, event, arg):
00065         # Callback registered with sys.setprofile()/sys.settrace()
00066         self.dispatch[event](self, frame)

Here is the caller graph for this function:

Remove calls to add_event().

Definition at line 49 of file test_sys_setprofile.py.

00049 
00050     def get_events(self):
00051         """Remove calls to add_event()."""
00052         disallowed = [ident(self.add_event.__func__), ident(ident)]
00053         self.frames = None
00054 
00055         return [item for item in self.events if item[2] not in disallowed]
00056 

Here is the call graph for this function:

Definition at line 67 of file test_sys_setprofile.py.

00067 
00068     def trace_call(self, frame):
00069         self.add_event('call', frame)
00070         self.stack.append(frame)

Here is the call graph for this function:

Definition at line 75 of file test_sys_setprofile.py.

00075 
00076     def trace_exception(self, frame):
00077         self.testcase.fail(
00078             "the profiler should never receive exception events")

Definition at line 79 of file test_sys_setprofile.py.

00079 
00080     def trace_pass(self, frame):
00081         pass

Definition at line 71 of file test_sys_setprofile.py.

00071 
00072     def trace_return(self, frame):
00073         self.add_event('return', frame)
00074         self.stack.pop()

Here is the call graph for this function:


Member Data Documentation

Initial value:
{
        'call': trace_call,
        'exception': trace_exception,
        'return': trace_return,
        'c_call': trace_pass,
        'c_return': trace_pass,
        'c_exception': trace_pass,
        }

Definition at line 82 of file test_sys_setprofile.py.

Definition at line 28 of file test_sys_setprofile.py.

Definition at line 27 of file test_sys_setprofile.py.

Definition at line 60 of file test_sys_setprofile.py.

Definition at line 59 of file test_sys_setprofile.py.


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