Example #1
0
    def trace_dispatch_call(self, frame):
        fcode = frame.f_code

        classname = ""
        if frame.f_locals:
            obj = frame.f_locals.get("self", None)
            if not obj is None:
                classname = obj.__class__.__name__ + "::"
            else:
                classname = ""

        methodname = fcode.co_name
        # methods with "?" are usually the files themselves (no method)
        # we now name them based on the file
        if methodname == "?":
            methodname = fcode.co_filename
            methodname = methodname[methodname.rfind("/") + 1:]
        tauname = classname + methodname
        filename = fcode.co_filename[fcode.co_filename.rfind("/") + 1:]
        tautype = '[{' + filename + '}{' + str(fcode.co_firstlineno) + '}]'

        # exclude the "? <string>" timer
        if not fcode.co_filename == "<string>":
            tautimer = pytau.profileTimer(tauname, tautype)
            pytau.start(tautimer)
Example #2
0
 def __init__(self):
     Timer.__init__(self)
     import pytau
     self.pytau = pytau
     self.tau_timers = {}
     pytau.setNode(mpi.rank)
     self.tau_timers[self.top_level] = pytau.profileTimer(self.top_level)
     pytau.start(self.tau_timers[self.top_level])
Example #3
0
 def __init__(self):
     Timer.__init__(self)
     import pytau
     self.pytau = pytau
     self.tau_timers = {}
     pytau.setNode(mpi.rank)
     self.tau_timers[self.top_level] = pytau.profileTimer(self.top_level)
     pytau.start(self.tau_timers[self.top_level])
Example #4
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
Example #5
0
def create_timer(name, fnc, pid):
    try:
        if os.environ['IPS_TIMING'] == '1':
            #import pytau
            #print 'created a timer', name + '.' + fnc, ' - ', pid
            return pytau.profileTimer(name + '.' + fnc, '', str(pid))
        #else:
        #print 'timing not on'
    except Exception, e:
        #print "*********** NO TIMING *************"
        #print e
        return None
Example #6
0
 def start(self, name):
     Timer.start(self, name)
     self.tau_timers[name] = pytau.profileTimer(name)
     pytau.start(self.tau_timers[name])
Example #7
0
 def start(self, name):
     Timer.start(self, name)
     self.tau_timers[name] = pytau.profileTimer(name)
     pytau.start(self.tau_timers[name])
Example #8
0
 def trace_dispatch_c_call(self, frame):
     if self.c_func_name == "start" or self.c_func_name == "stop" or self.c_func_name == "profileTimer" or self.c_func_name == "setprofile":
         pass
     else:
         tautimer = pytau.profileTimer(self.c_func_name, "")
         pytau.start(tautimer)