Table of Contents

Class: PyProfile eric3/Debugger/PyProfile.py

Class extending the standard Python profiler with additional methods.

This class extends the standard Python profiler by the functionality to save the collected timing data in a timing cache, to restore these data on subsequent calls, to store a profile dump to a standard filename and to erase these caches.

Base Classes   
profile.Profile
Methods   
__init__
erase
fix_frame_filename
restore
save
trace_dispatch_call
  __init__ 
__init__ (
        self,
        basename,
        timer=None,
        bias=None,
        )

Constructor

Arguments

basename
name of the script to be profiled (string)
timer
function defining the timing calculation
bias
calibration value (float)
  erase 
erase ( self )

Public method to erase the collected timing data.

  fix_frame_filename 
fix_frame_filename ( self,  frame )

Protected method used to fixup the filename for a given frame.

The logic employed here is that if a module was loaded from a .pyc file, then the correct .py to operate with should be in the same path as the .pyc. The reason this logic is needed is that when a .pyc file is generated, the filename embedded and thus what is readable in the code object of the frame object is the fully qualified filepath when the pyc is generated. If files are moved from machine to machine this can break debugging as the .pyc will refer to the .py on the original machine. Another case might be sharing code over a network... This logic deals with that.

Arguments

frame
the frame object
  restore 
restore ( self )

Private method to restore the timing data from the timing cache.

  save 
save ( self )

Public method to store the collected profile data.

  trace_dispatch_call 
trace_dispatch_call (
        self,
        frame,
        t,
        )

Private method used to trace functions calls.

This is a variant of the one found in the standard Python profile.py calling fix_frame_filename above.


Table of Contents

This document was automatically generated by HappyDoc version 2.1