Subject: Re: microtime() implementation
To: Darren Reed <avalon@cairo.anu.edu.au>
From: Simon Burge <simonb@wasabisystems.com>
List: port-i386
Date: 08/09/2004 19:43:20
Darren Reed wrote:

> Please excuse my ignorance of x86 stuff, but is it possible to implement
> microtime() using rdtsc() [if available] ?

It looks like we already do.  Look at arch/i386/i386/identcpu.c:

void
identifycpu(struct cpu_info *ci)
{
	...
        if (ci->ci_feature_flags & CPUID_TSC) {
	...
#ifndef NO_TSC_TIME
                microtime_func = cc_microtime;
#endif
        }

cc_microtime() is a cycle counter based microtime function.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/