Date: Fri, 16 Aug 2002 21:20:06 -0500 From: Will Andrews <will@csociety.org> To: Sean Hamilton <sh@planetquake.com> Cc: hackers@freebsd.org Subject: Re: microuptime() and nanouptime() library? Message-ID: <20020817022005.GB18228@squall.waterspout.com> In-Reply-To: <000701c24593$ceb71810$8eacb440@slugabed.org> References: <000701c24593$ceb71810$8eacb440@slugabed.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020817022005.GB18228>
