> method1  : 23573589435592    - 23573353927542 =   235508050
> method2  : 23573353927556    - 23573353927556 =           0
> method2A : 23573353927607    - 23573353927607 =           0
>  -- also m2_1 - m1_1 =         14
>  --  and m2A_1- m2_1 =         51
>  finally m2A_1- m1_1 =         65

Take a look at the code that gcc generates when compiling your program
with optimizations.  The "rdtsc" instruction is executed three times,
the program sleeps, and then rdtsc is executed only once more - hence
the strange results.  method2 and method2A are broken.  I don't
understand what the "mov edx, ecx" instruction in these functions is
supposed to accomplish.  Assuming that it is useful, you'll still need
to inform gcc that you're clobbering ecx.

method1 or something like it is what I've always used.

John Regehr

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to