On Fri, Aug 16, 2002 at 07:14:24PM -0700, Sean Hamilton wrote:
> Greetings,
> 
> I just tried to use nanouptime, then microuptime, but was disappointed to
> find that a quick grep of /usr/lib revealed no libraries containing these
> symbols.
> 
> Are they only available to the kernel. If so, how can I get a reasonable
> timer figure from user space?

Yes, they are limited to kernel space, as the section they belong
to implies:

<1 5005-0> (21:16:41) [will@puck ~]% man 9 nanouptime|head -5
MICROUPTIME(9)         FreeBSD Kernel Developer's Manual        MICROUPTIME(9)

NAME
     microuptime, getmicrouptime, nanouptime, getnanouptime - get the time
     elapsed since boot

gettimeofday() will return a 'struct timeval' which is accurate
to the microsecond.

There is also a 'struct timespec' defined in sys/time.h but I
believe it is restricted to kernel use (and nanotime() with it).

[..checking stuff..]

Actually.. perhaps not.  See clock_gettime(2), but I know nothing
about that system call.  It does appear to be similar to
gettimeofday() semantically and is a POSIX function, so it should
also be portable.

Regards,
-- 
wca

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to