Re: [linux-audio-dev] POSIX clocks now in linux 2.5

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] POSIX clocks now in linux 2.5
From: Paul Davis (paul_AT_linuxaudiosystems.com)
Date: Mon Mar 03 2003 - 18:34:23 EET


> > while (1) {
> > ...
> > usleep (usecs_till_next_event);
> > /* we're know its the right time,
> > instead of being rounded to
> > the default HZ
> > */
> > deliver_events ();
> > }
>
>Is this really new ? I was porting some C++ thread classes (originally
>developed for Solaris) to 2.4.19 this week. The ITC mechanism uses
>pthread_cond_timedwait(), which takes a struct timespec * referring to
>an absolute time, the same you can get with clock_gettime(). I had the
>impression this gave me almost microsecond resolution timing (but I did
>not look closesly at the precision at the time).

the kernel gives non-SCHED_FIFO/RR threads roughly 1/HZ
resolution. SCHED_FIFO/RR threads can get better than that if the
delay is very small, but its implemented by spinning on the
processor.

the new code will provide usec resolution without spinning. it
reprograms the APIC timer to interrupt the CPU at the right time. i
believe that you will still need capabilities, euid=0 and/or
SCHED_FIFO/RR to use it fully.

--p


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Mar 03 2003 - 18:26:26 EET