asm("rdtsc %0" : "=A"(start));
something;
asm("rdtsc %0" : "=A"(stop));
Since neither `start' nor `stop' is dependant on `something',
the compiler is justified in scheduling this as
asm("rdtsc %0" : "=A"(start));
asm("rdtsc %0" : "=A"(stop));
something;
or
something;
asm("rdtsc %0" : "=A"(start));
asm("rdtsc %0" : "=A"(stop));
which isn't quite what you wanted.
Adding the volatile makes the asm act as a scheduling barrier.
r~
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/