D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Interesting diagnostic problem

 

On Thursday 23 June 2005 00:54, John Daragon wrote:
> I'm looking at a problem that occurs in the asterisk PABX, and I'm 
> running out of inexpensive techniques, so I thought I'd canvas for ideas.
> 
> 
> Anyone know the real resolution of the hardware RTC ? Any other ideas ?
> 
> Anyone know of a cheap(ish) microsecond clock board ?


If i recall high resoultion timing is a stickly subject. It general the 
useable timer has a resoultion of 1ms which is pretty poor. Real time linux 
kernels have a better timer resoultion.

BUT the easy way to do (crude) timing is to use CPU clock counts. This is 1 
increment per CPU clock, so that will be GHz ish (depending on your processor 
of course). Good enough resolution for you? :-)

I will have to lookup what i did at work and post it, but it uses an inline 
asembler call to access the CPU clock count register directly. it returns a 
long long which is a *big* number. You can use the kernel function mdelay() 
or udelay() to provide a rough calibration by measuring the clock counts 
either side.

I used this approach to time USB enumuration within the kernel to see why my 
device was so flakely.

Regards,


-- 
Robin Cornelius
---------------------------------------------------
robin@xxxxxxxxxxxxxxxxxxxxx
http://www.cornelius.demon.co.uk
http://sourceforge.net/projects/rt2400
GPG Key ID: 0x729A79A23B7EE764
http://www.biglumber.com/x/web?qs=0x729A79A23B7EE764

Attachment: pgpFGqiXVkydE.pgp
Description: PGP signature