On Tue, 30 Aug 2005 13:36:57 -0400, Madhusudan Singh <[EMAIL PROTECTED]> wrote:
>Hi
>
>I am using time.clock() to get the current time of the processor in seconds.
>For my application, I need really high resolution but currently seem to be
>limited to 0.01 second. Is there a way to specify the resolution (say 1-10
>microseconds) ? My processor is a 1.4 MHz Intel processor. Surely, it
^--G?
>should be able to report times a few (or at least 10) microseconds apart.
>
windows or unix? time.time and time.clock seem to reverse roles as
best-resolution
time sources depending on which platform.
If you have a pentium with a rdtsc instruction, you can write an extension
module
in c to get at it. In C on a 300mhz p2 I got down to 23ns minimum delta between
calls, IIRC.
But even then I was subject to the small probability of an interrupt during my
timing loop,
and there are many normally going on, so the longer the interval you are timing
the greater
the probability that an interrupt will occur within it (assuming random
independence, which is
also not necessarily true). This is why timing frameworks generally either
average brute force
or discard outlier timings and average, or return best-of. All these have
different error
properties, and depend on lots of stuff.
I'm wondering whats your application is. Maybe you need a real-time OS?
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list