Benjamin Niemann <[EMAIL PROTECTED]> wrote:
>  Tobiah wrote:
> > On Unix...
>  What you want sound like the 'wall clock' time. The CPU time is the time
>  that the CPU spent on executing your process. And unless the process uses
>  100% of the CPU, CPU time will appear to be 'slower' than the wall clock.
>  In your little program above the CPU spent about one third of the time on
>  this process and the rest is used for other processes (e.g. updating the
>  display).
> 
>  What you need is time.time(), if its precision is sufficient.

In linux at least time.time() has microsecond precision.

>>> for i in range(10): print "%20.6f" % time.time()
... 
   1153130111.566463
   1153130111.566513
   1153130111.566535
   1153130111.566557
   1153130111.566578
   1153130111.566601
   1153130111.566621
   1153130111.566644
   1153130111.566665
   1153130111.566686

Wheras time.clock() only has 10 ms precision

>>> for i in range(10): print "%20.6f" % time.clock()
... 
            1.770000
            1.770000
            1.770000
            1.770000
            1.770000
            1.770000
            1.770000
            1.770000
            1.770000
            1.770000

time.clock() is elapsed cpu time of just that process.

I think the precisions are the other way round on windows.

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to