web2py has a profiler

424 views
Skip to first unread message

mdipierro

unread,
Feb 11, 2009, 1:01:16 AM2/11/09
to web2py Web Framework
New in trunk (highly experimental)

web2py.py -F profiler.log

will log all requests with profile details in profiler.log. This makes
thing slower.
I am not sure this is the proper way of doing it. Any feed back will
be appreciated.

It should be trivial to build an app (or an admin page) to browse and
search the profiler.log file if it exists.

Massimo

Wes James

unread,
Feb 11, 2009, 2:02:16 AM2/11/09
to web...@googlegroups.com
Massimo,

I just downloaded trunk and tried starting as normal and get:

WARNING:root:unable to import dbhash
default applications appear to be installed already
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2009
Version 1.56.2 (2009-02-10 23:57:30)
Database drivers available: SQLite3, Postgre
please visit:
http://127.0.0.1:6667
use "kill -SIGTERM 711" to shutdown the web2py server
Traceback (most recent call last):
File "./web2py.py", line 14, in <module>
start()
File "/opt/1web2py/gluon/widget.py", line 825, in start
path=options.folder)
File "/opt/1web2py/gluon/main.py", line 508, in __init__
log_filename, profiler_filename, web2py_path=path),
File "/opt/1web2py/gluon/main.py", line 425, in appfactory
if os.path.exists(profilerfilename):
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/posixpath.py",
line 171, in exists
st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found

but if i start with the command below it works fine.

-wj

Douglas Soares de Andrade

unread,
Feb 11, 2009, 4:55:34 AM2/11/09
to web...@googlegroups.com, Massimo Di Pierro
Hi Wes,

Try with the attached patch.

PS: Massimo, im sending to you too, so if that is alright we can put it in
trunk.
0020-fix-profilerlog.patch

notabene

unread,
Feb 11, 2009, 11:28:28 AM2/11/09
to web2py Web Framework
That's better. Thank You.

By the way. Remember to install python-profiler.

Niels

On Feb 11, 10:55 am, Douglas Soares de Andrade <dsandr...@gmail.com>
wrote:
> > On Tue, Feb 10, 2009 at 11:01 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > > New in trunk (highly experimental)
>
> > > web2py.py -F profiler.log
>
> > > will log all requests with profile details in profiler.log. This makes
> > > thing slower.
> > > I am not sure this is the proper way of doing it. Any feed back will
> > > be appreciated.
>
> > > It should be trivial to build an app (or an admin page) to browse and
> > > search the profiler.log file if it exists.
>
> > > Massimo
>
>
>
>  0020-fix-profilerlog.patch
> 4KViewDownload

mdipierro

unread,
Feb 11, 2009, 11:30:42 AM2/11/09
to web2py Web Framework
Sorry this patch will not do.

there must be one locker or the apps are not serialized when
profiling.

I fixed it in trunk anyway (please check).

Massimo

On Feb 11, 3:55 am, Douglas Soares de Andrade <dsandr...@gmail.com>
wrote:
> > On Tue, Feb 10, 2009 at 11:01 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > > New in trunk (highly experimental)
>
> > > web2py.py -F profiler.log
>
> > > will log all requests with profile details in profiler.log. This makes
> > > thing slower.
> > > I am not sure this is the proper way of doing it. Any feed back will
> > > be appreciated.
>
> > > It should be trivial to build an app (or an admin page) to browse and
> > > search the profiler.log file if it exists.
>
> > > Massimo
>
>
>
>  0020-fix-profilerlog.patch
> 4KViewDownload

Fran

unread,
Feb 11, 2009, 3:12:33 PM2/11/09
to web2py Web Framework
On Feb 11, 4:30 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I fixed it in trunk anyway (please check).

My Windows service still fails:

Traceback (most recent call last):
File "C:\Bin\web2py\gluon\winservice.py", line 40, in SvcDoRun
self.start()
File "C:\Bin\web2py\gluon\winservice.py", line 105, in start
profiler_filename=options.profiler_filename,
AttributeError: 'module' object has no attribute 'profiler_filename'

F

mdipierro

unread,
Feb 11, 2009, 4:35:56 PM2/11/09
to web2py Web Framework
Add this line:

profiler_filename = None

to your options_std.py file.

Massimo

Fran

unread,
Feb 11, 2009, 4:43:02 PM2/11/09
to web2py Web Framework
On Feb 11, 4:28 pm, notabene <niels...@gmail.com> wrote:
> By the way. Remember to install python-profiler.

Right - this bit my server too.
Needs documenting at least :/
Can this be made to fail gracefully if not present?
- not really backwards-compatible otherwise...

F

Fran

unread,
Feb 11, 2009, 4:45:34 PM2/11/09
to web2py Web Framework
On Feb 11, 9:35 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Add this line:
> profiler_filename = None
> to your options_std.py file.

options.py works, thanks - back in business :)

F

mdipierro

unread,
Feb 11, 2009, 4:47:37 PM2/11/09
to web2py Web Framework
OK. I made a change in trunk that will work without cProfile if no -F
option is specified.
Reply all
Reply to author
Forward
0 new messages