[Zope3-Users] Zope3 profiler ?

Marius Gedminas mgedmin at b4net.lt
Tue Jun 12 13:29:08 EDT 2007


On Tue, Jun 12, 2007 at 06:39:57PM +0200, Thierry Florac wrote:
> I'm looking for a simple solution to profile a Zope3 application, some
> kind of 'ZopeProfiler' product which was available for Zope2.

That would be a nice thing to have.

> Any link or advise would be welcome...

So far the easiest way I've found is to use my @profile adapter on the
view's __call__:

  from profilehooks import profile

  class MyViewClass(BrowserView):
      template = ViewPageTemplateFile('templates/mytemplate.pt')

      @profile(immediate=True)
      # if you specify immediate, each request will print the profile to stdout
      # if you don't, you'll get an aggregate profile when you stop the server
      def __call__(self):
          return self.template()

You can find profilehooks.py (MIT licence) with some usage examples at
http://mg.pov.lt/blog/profiling.html

You might also be interested in
http://mg.pov.lt/blog/benchmarking-zope3-apps.html

Marius Gedminas
-- 
Beware of bugs in the above code; I have only proved it correct, not tried it.
                -- Donald Knuth
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20070612/86edb97a/attachment.bin


More information about the Zope3-users mailing list