[python-win32] sleep() fine-control in Python - RDTSC, select() etc.
Tim Roberts
timr at probo.com
Tue Jan 25 19:37:13 CET 2005
On Mon, 24 Jan 2005 16:32:35 -0800, Ray S <rays at blue-cove.com> wrote:
>void main()
>{
> int ns= 1000000;
> // make the sleep in 100th nanoseconds.
> ns = (ns + 99)/100;
> //ns -= FACTOR;
>
> __asm {
> rdtsc
> // clock in EDX:EAX
> // we ignore EDX since we asume ns is
> // of shorter duration than that.
>
>
This assumption is dangerous. On a 4 GHz processor, the low-order 32
bits of rdtsc wraps every second.
64-bit arithmetic is easy in x86 assembly. You should get in the habit
of using it with rdtsc.
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list