Ejemplo n.º 1
0
 def runctx(self, cmd, globals, locals):
     self.enable()
     try:
         import pytau
         x = pytau.profileTimer(cmd)
         pytau.start(x)
         exec(cmd, globals, locals)
         pytau.stop(x)
     finally:
         self.disable()
     return self
Ejemplo n.º 2
0
def runctx(statement, globals, locals, filename=None):
    """Run statement under profiler, supplying your own globals and locals,
    optionally saving results in filename.

    statement and filename have the same semantics as profile.run
    """
    prof = Profile()
    try:
        prof = prof.runctx(statement, globals, locals)
    except SystemExit:
        pass
    pytau.stop()
Ejemplo n.º 3
0
def run(statement, filename=None, sort=-1):
    """Run statement under profiler optionally saving results in filename

    This function takes a single argument that can be passed to the
    "exec" statement, and an optional file name.  In all cases this
    routine attempts to "exec" its first argument and gather profiling
    statistics from the execution. If no file name is present, then this
    function automatically prints a simple profiling report, sorted by the
    standard name string (file/line/function-name) that is presented in
    each line.
    """
    prof = Profile()
    try:
        prof = prof.run(statement)
    except SystemExit:
        pass
    pytau.stop()
Ejemplo n.º 4
0
 def stop(self, name=None):
     Timer.stop(self, name)
     pytau.stop(self.tau_timers[name])
Ejemplo n.º 5
0
def stop(timer):
    if timer != None:
        #import pytau
        pytau.stop(timer)
    else:
        pass
Ejemplo n.º 6
0
 def stop(self, name=None):
     Timer.stop(self, name)
     pytau.stop(self.tau_timers[name])
Ejemplo n.º 7
0
 def trace_dispatch_c_return(self, frame):
     if self.c_func_name == "start" or self.c_func_name == "stop" or self.c_func_name == "profileTimer":
         pass
     else:
         pytau.stop()
Ejemplo n.º 8
0
 def trace_dispatch_return(self, frame):
     # exclude the "? <string>" timer
     if not frame.f_code.co_filename == "<string>":
         pytau.stop()