Miroslav,

I reached out to find nine NTP servers with known good pedigree, except NIST. I found precissions ranging from -19 to -22, bu nothing better. These included Sun UltraSPARC, Sun Blade, Intel dual-core, Intel Pentium and ia64. They were running Linux 2.6, FreeBSD 6.1 and 8.0, SunOS 5.10 and 5.11, and HP-UX 11.31. So far as I know, they are all running ntpd and all measure the precision using the get_systime() routine. Note there is quite a bit more than the syscall in that routine, as it involves normalizing to NTP timestamp format and fuzzing the low-order bits. That last requires calling the Unix random() routine. If you can do all that in 119 ns, you have a screamer.

Dave

Miroslav Lichvar wrote:

On Thu, Sep 16, 2010 at 01:23:28AM +0000, David L. Mills wrote:
The fastest machine I can find on campus has precision -22, or about
230 ns. Then, I peeked at time.nist.gov, which is actually three
machines behind a load leveler. It reports to be an i386 running
FreeBSD 61. Are you ready for this? It reports precision -29 or 1.9
ns! I'm rather suspiciousabout that number. What  processor and
operating system are you using. What is the precision reported by
ntpd?

The processor is 2.4GHz Intel Core 2 with two cores and it's running
Linux 2.6.35. The precision reported by ntpd is -23.

As I have said, this is with the tsc clocksource. Kernel uses tsc only
when it's reliable and this seems to depend on used hardware
combination. When switched to hpet clocksource, the precision is 480
ns and with acpi_pm clocksource it's 1900 ns.

To give you an idea what would be the precision with tsc if there was
no system overhead, try this program:

#include <stdio.h>
#include <sys/time.h>

#define rdtsc(val) \
__asm__ __volatile__("rdtsc" : "=a" (val) : : "edx")
#define NUM 1000000

int main() {
        int a, b, i;
        struct timeval tv1, tv2;
        gettimeofday(&tv1, NULL);
        gettimeofday(&tv1, NULL);
        rdtsc(a);
        for (i = 0; i < NUM; i++)
                rdtsc(b);
        gettimeofday(&tv2, NULL);
        i = (tv2.tv_sec - tv1.tv_sec) * 1000000 + tv2.tv_usec - tv1.tv_usec;
        printf("%f MHz, rdtsc: %f nanoseconds, %f cycles\n",
                        (double)(b - a) / i,
                        (double)i * 1000 / NUM,
                        (double)(b - a) / NUM);
        return 0;
}

The dual-core Core 2 CPU:
2394.053013 MHz, rdtsc: 28.012000 nanoseconds, 67.062213 cycles

A single-core Athlon 64:
2000.448523 MHz, rdtsc: 3.351000 nanoseconds, 6.703503 cycles


_______________________________________________
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions

Reply via email to