def stats(self, filename, sortby='cumulative'):
        """Generate statistics from given profile.

        :returns: The sorted stats index printout.
        :rtype: str
        """
        sio = io.StringIO()
        s = pstats.Stats(os.path.join(self.path, filename), stream=sio)
        s.strip_dirs()
        s.sort_stats(sortby)
        s.print_stats()
        response = sio.getvalue()
        sio.close()
        return response
Generate statistics from given profile.

        :returns: The sorted stats index printout.
        :rtype: str
        
cherrypy/lib/profiler.py