Package cherrypy :: Package lib :: Module profiler
[hide private]
[frames] | no frames]

Module profiler

source code

Profiler tools for CherryPy.

CherryPy users
==============

You can profile any of your pages as follows:

    from cherrypy.lib import profiler
    
    class Root:
        p = profile.Profiler("/path/to/profile/dir")
        
        def index(self):
            self.p.run(self._index)
        index.exposed = True
        
        def _index(self):
            return "Hello, world!"
    
    cherrypy.tree.mount(Root())


You can also turn on profiling for all requests
using the make_app function as WSGI middleware.


CherryPy developers
===================

This module can be used whenever you make changes to CherryPy,
to get a quick sanity-check on overall CP performance. Use the
"--profile" flag when running the test suite. Then, use the serve()
function to browse the results in a web browser. If you run this
module from the command line, it will call serve() for you.

Classes [hide private]
  Profiler
  ProfileAggregator
  make_app
Functions [hide private]
 
new_func_strip_path(func_name) source code
 
serve(path=None, port=8080) source code
Variables [hide private]
  msg = "Your installation of Python does not have a profile mod...
  _count = 0

Imports: profile, pstats, warnings, os, sys, StringIO


Variables Details [hide private]

msg

Value:
"Your installation of Python does not have a profile module. " "If you\
're on Debian, you can apt-get python2.4-profiler from " "non-free in \
a separate step. See http://www.cherrypy.org/wiki/" "ProfilingOnDebian\
 for details."