CPU time

Tim Roberts timr at probo.com
Sat Oct 13 00:00:30 EDT 2001


Skip Montanaro <skip at pobox.com> wrote:
>
>    >> I thought time.clock() measures CPU time which (i assume) is
>    >> consistent regardless of other S/W running.. but somehow the
>    >> measurement fluctuates a lot. Am I misunderstanding this function? If
>    >> so, what is the function w/ the functionality I'm looking for?
>...
>
>If you are using Win32, time.clock uses a Windows routine called
>QueryPerformanceCounter.  I have no direct experience with it, but I am told
>that it returns a value that is independent of what process has the
>processor.

Correct.  QueryPerformanceCounter measures total time since boot.
time.clock() on Win32 returns the total elapsed seconds since the first
call to time.clock() in the process.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list