Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Nov 1998 16:39:32 -0800
From:      Mike Smith <mike@smith.net.au>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Peter Wemm <peter@netplex.com.au>, Poul-Henning Kamp <phk@critter.freebsd.dk>, Mike Smith <mike@smith.net.au>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/kern kern_clock.c 
Message-ID:  <199812010039.QAA06826@dingo.cdrom.com>
In-Reply-To: Your message of "Mon, 30 Nov 1998 10:05:41 PST." <199811301805.KAA00788@apollo.backplane.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
>     Someone tell me if I'm missing something here:  Why aren't we simply
>     scaling (at least for the higher-end cpu's) the 64 bit cycle counter
>     register?  It seems simple enough to me.  It's frequency needs to be
>     calculated but it should be reasonably stable once that is done and 
>     there are *no* overflow problems.

Because the TSC is tied to the CPU clock, which is not guaranteed to be 
constant (any system with power management will change the CPU clock).

It's erroneous to use the TSC other than in exceptional circumstances 
on the i386.  I don't know of any Alpha systems that dink the clock, so 
the relationship between their cycle counter and real time is more 
definite.

>     That is, use the standard timer interrupt to generate hardclocks, but 
>     base all time operations off the scaled 64 bit cycle counter for cpu's
>     that support it.  We would *not* use the 82C54's timer registers to
>     actually try to read out the counter at all unless we were running on 
>     much older cpu's.

Unfortunately, the i8254 is the only thing in the system that can be 
expected to run at more or less the rate you set it to.

>     If we dynamically scale the 64 bit counter down to 32 bits and guarentee
>     a scaling factor that guarentees us at least 1 hour @ 32 bits before
>     rollover, we still have a resolution of 0.838 uS (or, at worse using
>     a power-of-2 scaling, 1.6 uS).  
> 
>     Seems dandy to me!

It would, until the TSC starts varying in speed. 

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812010039.QAA06826>