On Thursday, July 28, 2011 2:29:46 PM UTC-4, Tobarja wrote:
>
> This was my first project in python, so I am sure most of it looks
> suspicious. Only one of the app/controller/*.py files has been touched
> this year, back in March.
>
> I use this app once a month. It was fine last month.
>
> Is there any way to get a profile of where web2py's spending it's time?
>
If you start web2py from the command line, you can add the -F flag to run
the profiler (see
http://web2py.com/book/default/chapter/04#Command-Line-Options). It uses the
cProfile and pstats modules. To profile when running with another server, I
suppose you could edit the wsgihandler.py file -- set LOGGING=True and
specify a filename for the profilerfilename argument to
gluon.main.appfactory (see
http://web2py.com/book/default/chapter/04#External-Middleware).
Also, the time taken for each SQL query is stored in db._timings. An easy
way to view those timings is to include {{=response.toolbar()}} in a view.
Anthony