Subject: Re: timing issue
To: None <netbsd-users@netbsd.org>
From: Michael van Elst <mlelstv@serpens.de>
List: netbsd-users
Date: 11/19/2006 08:10:06
jakllsch@kollasch.net ("Jonathan A. Kollasch") writes:

>Because FreeBSD 6.1 has timecounters. NetBSD 3.1 does not. You really want
>to test this on netbsd-4 or -current, as timecounters were added since
>the 3.x branches.

On 4.0_BETA:

kern.timecounter.choice = clockinterrupt(q=0, f=100 Hz) TSC(q=-100, f=1666762200
 Hz) ACPI-Safe(q=900, f=3579545 Hz) i8254(q=100, f=1193182 Hz) dummy(q=-1000000,
 f=1000000 Hz)
kern.timecounter.hardware = ACPI-Safe

% ./timing 
gettimeofday:        5 usec
nanosleep:       14604 usec
usleep:          19897 usec
select:          19905 usec


Looks like it is more related to HZ than to time counters. Minimum
resolution seems to be 2 ticks. The first measurement (nanosleep)
is shorter because it starts somewhere within a clock cycle, the
next measurements are synchronized to it.


-- 
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."