[Zope3-Users] Re: execution time of a request?

Jürgen Kartnaller juergen at kartnaller.at
Sat Apr 7 07:21:39 EDT 2007


By the way, marius, thanks for your great profiling library.

We used it this week to track down our performance issues and could 
increase the speed of some of our functions by a factor of 10 or more(!)

The zope index checkin's this week result from using your profile 
decorator. Especially the change in z3c.tag could easily be tracked down 
by simply adding @profile to our code.

Jürgen


Marius Gedminas wrote:
> On Fri, Apr 06, 2007 at 11:15:47PM +0200, Maciej Wisniowski wrote:
>>> does anyone know a method to get or compute the execution time of a
>>> request?
>> Lori - plugin for firefox, or firebug etc?
>> Or do you want to display this on page?
> 
> Firebug doesn't quite cut it: it only displays time spent downloading,
> not the time spent waiting until Zope processes the request.
> 
> I usually wrap my view's __call__ in a @timecall decorator like this:
> 
> def timecall(fn):
>     def new_fn(*args, **kw):
>         try:
>             start = time.time()
>             return fn(*args, **kw)
>         finally:
>             duration = time.time() - start
>             funcname = fn.__name__
>             filename = fn.func_code.co_filename
>             lineno = fn.func_code.co_firstlineno
>             print >> sys.stderr, "\n  %s (%s:%s):\n    %.3f seconds\n" % (
>                                         funcname, filename, lineno, duration)
>     new_fn.__doc__ = fn.__doc__
>     return new_fn
> 
> 
> Marius Gedminas
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users



More information about the Zope3-users mailing list