def print_stats(self, profiler):
        name = (self._type + '-' + self.name) if self._type else self.name
        filename = os.path.join(self.profile_dir, name)
        logging.debug('Printing stats for {name}'.format(name=name))
        s = StringIO.StringIO()
        sortby = 'cumulative'
        ps = pstats.Stats(profiler, stream=s)
        # Take out directory names
        ps.strip_dirs()
        # Sort
        ps.sort_stats(sortby)
        # Print to the stream
        ps.print_stats()

        stats_file = filename + '.stats'
        profile_file = filename + '.profile'
        # Create the stats file
        ps.dump_stats(stats_file)
        # Create a readable .profile file
        with open(profile_file, 'w') as f:
            f.write(s.getvalue())
dataset/ETHPy150Open lobocv/pyperform/pyperform/thread.py/_Profiler.print_stats/original