python - Profiling CherryPy -


i've been trying start profiling cherrypy webserver, documentation lacking in detail in how should set up. understand should able use cherrypy.lib.profiler middleware mount initial server. right now, have code following:

server_app = serverclass() cherrypy.tree.mount(server_app, '/', '/path/to/config/file.cfg') cherrypy.engine.start() cherrypy.engine.block() 

i want mount profiling middleware, , seems following required:

from cherrypy.lib import profiler  server_app = serverclass() server_cpapp = cherrypy.application(server_app, '/', '/path/to/config/file.cfg') server_profile_cpapp = profiler.make_app(server_cpapp, '/home/ken/tmp/cprofile', true) #cherrypy.tree.mount(server_profile_cpapp) cherrypy.tree.graft(server_profile_cpapp)  cherrypy.engine.start() cherrypy.engine.block() 

for reason cherrypy.tree.mount doesn't work, if use cherrypy.tree.graft seems operate fine (i can make requests server normal)

however, above code generates cp_0001.prof file under /home/ken/tmp/cprofile , not sure how interpret it. have tried using pyprof2calltree read data kcachegrind, parsing error. i'm doing seem correct, , if how interpret output file?

it turns out profile files generated cherrypy can interpreted using profiler.py script shipped part of cherrypy. run profiler.py in <site-packages>/cherrypy/lib directory follows:

python profiler.py /directory/containing/prof/files 8080 

then navigate localhost:8080 in browser , profiling results .prof files in target directory displayed in simple text interface.

i still prefer able export results calltree profile using kcachegrind, seems basic profiling.

this documented in change log v2.1 of cherrypy when profiler introduced (although other details on page describing how set profiler has since become deprecated)


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -