[Tutor] My First Python Program

alan.gauld@bt.com alan.gauld@bt.com
Tue, 8 Oct 2002 17:17:56 +0100


> Where's the Python profiler then?

In the profile module. Read the docs for info on how to use it.

Output looks like:

>>> profile.run("foo()")
...output here....
         3 function calls in 1.007 CPU seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.024    0.024    0.024    0.024 <stdin>:1(foo)
        1    0.000    0.000    0.024    0.024 <string>:1(?)
        1    0.983    0.983    1.007    1.007 profile:0(foo())
        0    0.000             0.000          profile:0(profiler)

HTH,

Alan G.