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)
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])
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
def start(self, name): Timer.start(self, name) self.tau_timers[name] = pytau.profileTimer(name) pytau.start(self.tau_timers[name])
def start(timer): if timer != None: #import pytau pytau.start(timer) else: pass
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)