[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: precision timer?



gettimeofday has 40 us precision on ETRAX 100 LX using a fairly new kernel.
Note that meassuring time from userspace gives unpredictable results since
the kernel may choose to run other processes between your calls to gettimeofday.

-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com">mailto:owner-dev-etrax@xxxxxxx.com] On Behalf Of Christer Weinigel
Sent: Tuesday, July 01, 2003 3:30 AM
To: Kevin Wooley
Cc: dev-etrax
Subject: Re: precision timer?


Kevin Wooley <kwooley@xxxxxxx.com> writes:

> BTW, I'm looking for 1-10uS precision at best, 1mS precision at the 
> worst. Pretty big range, but I'll take what I can get with minimal 
> effort.

> > My suspicion is that I should somehow use either the Real Time Clock 
> > on the devboard or one of the built in hardware timers.  I'd rather 
> > do this in user space than driver/kernel space.  I don't need to 
> > trigger other events, just measure the time between two function 
> > calls.

Just use the normal gettimeofday system call, it has usec precision and is probably fairly accurate too.  If the accuracy isn't good enough for your needs, it's always possible to improve the kernel code that supplies the time to the gettimeofday call.

  /Christer

-- 
"Just how much can I get away with and still go to heaven?"

Freelance consultant specializing in device driver programming for Linux 
Christer Weinigel <christer@xxxxxxx.se">http://www.weinigel.se