Subject: Re: speeding up microtime
To: Jukka Marin <jmarin@pyy.jmp.fi>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: port-i386
Date: 08/02/2002 13:50:51
The i386mp branch contains microtime implementation using TSC
counters.  I even 'ported' that to HEAD code. It is indeed _much_
faster that the one using i8254 clock. Problem is would not work
too well with variable-rate processors (like SpeedStep, Crusoe etc).

Jaromir

Jukka Marin wrote:
[ Charset ISO-8859-1 unsupported, converting... ]
> On Thu, Aug 01, 2002 at 05:30:44PM +0100, David Laight wrote:
> > > This cut the execution time for gettimeofday() call from
> > > about 6.3us to 4.1us by removing 2 of the 4 'inb' instructions
> > > from the usual code path.
> > > I expect the 'standard' code takes 5us since I'd already made
> > > other changes to the same bit of code.
> > 
> > It was 5.3us
> > 
> > I've just reworked it again to avoid reading the status from
> > the interrupt controller.  Test program gives 2.85us
> > unfortunately it doesn't quite work :-( and I have to go out.
> 
> Would it be possible to use the various counters present on the decent
> pentium CPU's and their relatives?  Accesses to original pc hardware
> timers is slow, but accessing the CPU counters is much faster.
> 
> 5 _s sounds like an eternity on a fast CPU.. thousands of instruction
> cycles wasted! :-I
> 
> Disclaimer: I don't actually _know_ the CPU architecture :-)
> 
>   -jm
> 


-- 
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/Ports/i386/ps2.html
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-