On Wed, Oct 31, 2001 at 05:37:18PM -0700, John Regehr wrote: > > 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.
Don't forget to make sure it's __volatile__, elsewise this is the very epitome of what would produce dodgy results... Gary (-; -- [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/
