[ntp:questions] Re: linux system clock egregiously slow!

David Wuertele dave-gnus at bfnet.com
Wed Jan 21 21:10:26 UTC 2004

Me> 0.  turn off interrupts
Me> 1.  make sure the MIPS real-time clock is running
Me> 2.  store the 32-bit number "270,000,000" (ten seconds) into
Me>     countdown timer #5 
Me> 3.  store zero into the program cycle counter
Me> 4.  loop while timer #5 > 270,000,000 minus 2,700,000 (.1 seconds)
Me> 5.  read back the program cycle counter: that is the number of
Me>     cycles in .1 seconds
Me> mips_counter_frequency = (number of cycles in .1 seconds) * 10

Hal> That looks like a resonable recipe to me, but that doesn't mean
Hal> it works as expected.  What rate is timer #5 running at?  Is
Hal> there some roundoff in setting it up?

Timer #5 is running off a 27MHz crystal with a spec of +/-30PPM.
Since the MIPS core is running at 300MHz, I expect that the error in
setting timer #5 is on the order of ten times smaller than the crystal

Hal> Print out the value and see if it makes sense.

It says about 149MHz, which is what I expect.

Hal> There have been round off errors when HZ was a strange value.  I
Hal> forget the details.

Hmm... I'll look into that, but HZ is 100, which is about un-strange
as it gets.


More information about the questions mailing list