[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.
From: firstname.lastname@example.org">mailto:email@example.com] On Behalf Of Christer Weinigel
Sent: Tuesday, July 01, 2003 3:30 AM
To: Kevin Wooley
Subject: Re: precision timer?
Kevin Wooley <firstname.lastname@example.org> 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
> > 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.
"Just how much can I get away with and still go to heaven?"
Freelance consultant specializing in device driver programming for Linux
Christer Weinigel <email@example.com">http://www.weinigel.se