I just checked in util/easyprof.py

It contains two useful things for doing quick and easy profiles of specific methods in a class

Here's how you use them:

from util.easyprof import Profile, QuickProfile

To profile just one method of a class:

class A(object):
    @QuickProfile("sizing.prof")
    def OnSize(self, ...):
        ...

This will create onemethod.prof and profile all calls to mymethod(). Note you cannot do QuickProfile() on two separate methods with the same filename, or hotshot will try to open the file twice, and I have no idea what happens then.

To profile a couple methods in a class:

p = Profile("sizingandpainting.prof")

class A(object):
    @p.profiled
    def OnSize(self,...):
        ...

    @p.profiled
    def OnPaint(self,...):
        ...


That's it! You can also profile multiple methods across different classes in the same file, or reuse the Profile object wherever you want.


Alec
Enjoy.

Alec
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev

Reply via email to