How to measure execution time of a program

Fredrik Lundh fredrik at pythonware.com
Wed Jun 28 11:05:06 EDT 2006


Grant Edwards wrote:

>> You can get better resolution by using time.clock() instead of
>> time.time().
>
> Oh really?  When I do it, time.clock() is worse:

on Unix, time.clock() is a tick counter; if your process is running when the tick
interrupt arrives, the internal counter value is incremented (whether the process
actually used the full tick slot or not).  the tick resolution is usually 1-10 milli-
seconds.

on Windows, time.clock() is a high-resolution CPU counter, with microsecond
resolution.

</F> 






More information about the Python-list mailing list