

def run(self):
    profiler = cProfile.Profile()
    try:
        logging.debug('{cls}: Starting {cls}: {name}'.format(cls=self._type, name=self.name))
        profiler.runcall(super(_Profiler, self).run)
        logging.debug('{cls}: Prepating to exit {cls}: {name}'.format(cls=self._type, name=self.name))
    except Exception as e:
        logging.error('{cls}: Error encountered in {name}'.format(cls=self._type, name=self.name))
        logging.error(e)
        if self.exception_callback:
            (e_type, e_value, last_traceback) = sys.exc_info()
            self.exception_callback(e_type, e_value, last_traceback)
    finally:
        if (self.profile_dir is None):
            logging.warning("{cls}: profile_dir is not specified. Profile '{name}' will not be saved.".format(cls=self._type, name=self.name))
            return
        self.print_stats(profiler)

dataset/ETHPy150Open lobocv/pyperform/pyperform/thread.py _Profiler.run/original