Beispiel #1
0
 def _localtrace(self, frame, why, arg):
     if why == 'return':
         code = frame.f_code
         if not scorep._bindings.try_region_end(code):
             if not code.co_name == "_unsetprofile":
                 modulename = get_module_name(frame)
                 if not modulename[:6] == "scorep":
                     scorep._bindings.region_end(modulename, code.co_name,
                                                 code)
     return self._localtrace
Beispiel #2
0
    def _globaltrace(self, frame, why, arg):
        """Handler for call events.

        If the code block being entered is to be ignored, returns `None',
        else returns self.localtrace.
        """
        if why == 'call':
            code = frame.f_code
            if not scorep._bindings.try_region_begin(code):
                if not code.co_name == "_unsetprofile":
                    modulename = get_module_name(frame)
                    if not modulename[:6] == "scorep":
                        file_name = code.co_filename
                        line_number = code.co_firstlineno
                        scorep._bindings.region_begin(modulename, code.co_name, file_name, line_number, code)
        elif why == 'return':
            code = frame.f_code
            if not scorep._bindings.try_region_end(code):
                if not code.co_name == "_unsetprofile":
                    modulename = get_module_name(frame)
                    if not modulename[:6] == "scorep":
                        scorep._bindings.region_end(modulename, code.co_name, code)
 def _globaltrace(self, frame, why, arg):
     """Handler for call events.
     @return self.localtrace or None
     """
     if why == 'call':
         code = frame.f_code
         modulename = get_module_name(frame)
         if not code.co_name == "_unsettrace" and not modulename[:6] == "scorep":
             full_file_name = get_file_name(frame)
             line_number = code.co_firstlineno
             scorep._bindings.region_begin(modulename, code.co_name, full_file_name, line_number, code)
             return self._localtrace
     return None
 def _localtrace(self, frame, why, arg):
     if why == 'return':
         code = frame.f_code
         modulename = get_module_name(frame)
         scorep._bindings.region_end(modulename, code.co_name, code)
     return self._localtrace