[Olsr-users] Broadcast Packets & Windows Routin

Juliusz Chroboczek (spam-protected)
Thu Mar 13 20:57:33 CET 2008


> I would throw in the following neat trick which only works on totally  
> non-portable pentium 3 minimum systems:
[...]
> static inline unsigned long long read_tsc(void)
> {
>          unsigned long high, low;
>          __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high));
>          return ((unsigned long long)high << 32) | low;
> }
[...]
> Take that swiss watchmakers ;-))))

I'm not Swiss, and I'm not a watchmaker, but I really don't recommend
doing that.

It is implementation-dependent what happens to your TSC when the
kernel puts the CPU into idle.  With many x86 chipsets, the TSC will
stop increasing in C2.

What is more, on modern Linux kernels gettimeofday will transparently
use the TSC or the ACPI timer (whichever happens to work on your
particular machine) to give you sub-tick precision.  On a 1.2 GHz
Pentium-M and a recent Linux 2.6 kernel, I have measured gettimeofday
as having a granularity of roughly 3 us.

                                        Juliusz




More information about the Olsr-users mailing list