On Apr 11, 2:49 pm, [EMAIL PROTECTED] wrote:
> how do i profile a program? i found out that there are some profilers
> included in the standard library but couldnt really figure out how to
> access/use them

I put this at the bottom of my main module:

=== cut
if __name__=="__main__":
    try:
        from cProfile import run
    except:
        from profile import run
    run("tests()")
=== cut

Here tests() is the function I want to profile.  The cProfile
module, when available is better than the older profile module,
but it's only available in very recent Python installations.
The profile "run" function will run the tests function and print
a report on the timings and counts it found.

More info here:
  http://docs.python.org/lib/profile.html

  -- Aaron Watters
===
http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=emulate+perl
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to