How could i get execution times ?

Andrei Kulakov ak at silmarill.org
Fri Jun 7 15:22:33 EDT 2002


In article <adkjro$12183k$1 at ID-146704.news.dfncis.de>, Shagshag13 wrote:
> 
> I'm looking for a way to get execution time at different points of a program, by now i use the
> code below, but i've seen in some post that time.clock() could be a better way to measure this,
> 
> So my question, is how you pythoners do it ??? and to understand _why_ ?
> 
> Thanks
>
profile:

>>> import profile
>>> def f():
...  for i in range(10000):
...   5*350 

>>> profile.run('f')
         2 function calls in 0.020 CPU seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.000    0.000 <string>:1(?)
        1    0.020    0.020    0.020    0.020 profile:0(f)
        0    0.000             0.000          profile:0(profiler)


 - Andrei


-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org



More information about the Python-list mailing list