public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* High res timer?
@ 2005-05-10 20:27 Andre Eisenbach
  2005-05-10 20:34 ` Lee Revell
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Andre Eisenbach @ 2005-05-10 20:27 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hello!

We're currently using pth_usleep() as a timer for a userspace audio
application. However, it doesn't seem very accurate and reliable. Is
there a better (more accurate) timer that we can call form a userspace
application?

Thanks,
    Andre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: High res timer?
  2005-05-10 20:27 High res timer? Andre Eisenbach
@ 2005-05-10 20:34 ` Lee Revell
  2005-05-10 21:18   ` Andre Eisenbach
  2005-05-10 20:38 ` Lee Revell
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Lee Revell @ 2005-05-10 20:34 UTC (permalink / raw)
  To: Andre Eisenbach; +Cc: Linux Kernel Mailing List

On Tue, 2005-05-10 at 13:27 -0700, Andre Eisenbach wrote:
> Hello!
> 
> We're currently using pth_usleep() as a timer for a userspace audio
> application. However, it doesn't seem very accurate and reliable. Is
> there a better (more accurate) timer that we can call form a userspace
> application?

Why don't you just clock off the sound card?

Lee


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: High res timer?
  2005-05-10 20:27 High res timer? Andre Eisenbach
  2005-05-10 20:34 ` Lee Revell
@ 2005-05-10 20:38 ` Lee Revell
  2005-05-10 20:45 ` Matthias-Christian Ott
  2005-05-10 21:53 ` George Anzinger
  3 siblings, 0 replies; 9+ messages in thread
From: Lee Revell @ 2005-05-10 20:38 UTC (permalink / raw)
  To: Andre Eisenbach; +Cc: Linux Kernel Mailing List

On Tue, 2005-05-10 at 13:27 -0700, Andre Eisenbach wrote:
> Hello!
> 
> We're currently using pth_usleep() as a timer for a userspace audio
> application. However, it doesn't seem very accurate and reliable. Is
> there a better (more accurate) timer that we can call form a userspace
> application?
> 

Also, this is a bit OT for LKML.  Try linux-audio-dev at
music.columbia.edu.  You can probably find several good ways to do it in
the archives. 

Lee


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: High res timer?
  2005-05-10 20:27 High res timer? Andre Eisenbach
  2005-05-10 20:34 ` Lee Revell
  2005-05-10 20:38 ` Lee Revell
@ 2005-05-10 20:45 ` Matthias-Christian Ott
  2005-05-10 21:16   ` Andre Eisenbach
  2005-05-10 21:53 ` George Anzinger
  3 siblings, 1 reply; 9+ messages in thread
From: Matthias-Christian Ott @ 2005-05-10 20:45 UTC (permalink / raw)
  To: Andre Eisenbach; +Cc: Linux Kernel Mailing List

Andre Eisenbach wrote:
> Hello!
> 
> We're currently using pth_usleep() as a timer for a userspace audio
> application. However, it doesn't seem very accurate and reliable. Is
> there a better (more accurate) timer that we can call form a userspace
> application?
> 
> Thanks,
>     Andre
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
What about nanosleep ()?

Matthias-Christian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: High res timer?
  2005-05-10 20:45 ` Matthias-Christian Ott
@ 2005-05-10 21:16   ` Andre Eisenbach
  2005-05-10 21:29     ` Lee Revell
  0 siblings, 1 reply; 9+ messages in thread
From: Andre Eisenbach @ 2005-05-10 21:16 UTC (permalink / raw)
  To: Matthias-Christian Ott; +Cc: Linux Kernel Mailing List

2005/5/10, Matthias-Christian Ott <matthias.christian@tiscali.de>:
>
> What about nanosleep ()?
> 

nanosleep() seems to have some latency very similar to usleep(). Isn't
usleep based on nanosleep()?

Here's what I get if I try to nanosleep for 5 secs (for testing):

-> 5.009952 s

The .009952 part varies, but is very close to that usually.

Thanks,
    Andre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: High res timer?
  2005-05-10 20:34 ` Lee Revell
@ 2005-05-10 21:18   ` Andre Eisenbach
  0 siblings, 0 replies; 9+ messages in thread
From: Andre Eisenbach @ 2005-05-10 21:18 UTC (permalink / raw)
  To: Lee Revell; +Cc: Linux Kernel Mailing List

2005/5/10, Lee Revell <rlrevell@joe-job.com>:
> On Tue, 2005-05-10 at 13:27 -0700, Andre Eisenbach wrote:
> 
> Why don't you just clock off the sound card?
> 

I'll look into this.

Oh, and sorry for the off-topic :(

Thanks,
    Andre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: High res timer?
  2005-05-10 21:16   ` Andre Eisenbach
@ 2005-05-10 21:29     ` Lee Revell
  2005-05-10 21:41       ` Andre Eisenbach
  0 siblings, 1 reply; 9+ messages in thread
From: Lee Revell @ 2005-05-10 21:29 UTC (permalink / raw)
  To: Andre Eisenbach; +Cc: Matthias-Christian Ott, Linux Kernel Mailing List

On Tue, 2005-05-10 at 14:16 -0700, Andre Eisenbach wrote:
> 2005/5/10, Matthias-Christian Ott <matthias.christian@tiscali.de>:
> >
> > What about nanosleep ()?
> > 
> 
> nanosleep() seems to have some latency very similar to usleep(). Isn't
> usleep based on nanosleep()?
> 
> Here's what I get if I try to nanosleep for 5 secs (for testing):
> 
> -> 5.009952 s
> 
> The .009952 part varies, but is very close to that usually.

Is this a 2.4 kernel?  The resolution on 2.6 should be 1ms, not ~10ms.

Lee


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: High res timer?
  2005-05-10 21:29     ` Lee Revell
@ 2005-05-10 21:41       ` Andre Eisenbach
  0 siblings, 0 replies; 9+ messages in thread
From: Andre Eisenbach @ 2005-05-10 21:41 UTC (permalink / raw)
  To: Lee Revell; +Cc: Matthias-Christian Ott, Linux Kernel Mailing List

2005/5/10, Lee Revell <rlrevell@joe-job.com>:
> > Here's what I get if I try to nanosleep for 5 secs (for testing):
> >
> > -> 5.009952 s
> >
> > The .009952 part varies, but is very close to that usually.
> 
> Is this a 2.4 kernel?  The resolution on 2.6 should be 1ms, not ~10ms.

Yes indeed, that was a 2.4 kernel. On 2.6 (different machine though) I get:

-> 5.001064 s

Thanks,
    Andre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: High res timer?
  2005-05-10 20:27 High res timer? Andre Eisenbach
                   ` (2 preceding siblings ...)
  2005-05-10 20:45 ` Matthias-Christian Ott
@ 2005-05-10 21:53 ` George Anzinger
  3 siblings, 0 replies; 9+ messages in thread
From: George Anzinger @ 2005-05-10 21:53 UTC (permalink / raw)
  To: Andre Eisenbach; +Cc: Linux Kernel Mailing List

Andre Eisenbach wrote:
> Hello!
> 
> We're currently using pth_usleep() as a timer for a userspace audio
> application. However, it doesn't seem very accurate and reliable. Is
> there a better (more accurate) timer that we can call form a userspace
> application?

You don't say what resolution you want, but to ~ 1 ms, nanosleep or 
clock_nanosleep should work.  If you need better resolution, check out the HRT 
patch, see sig. below.

-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-05-11  1:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-10 20:27 High res timer? Andre Eisenbach
2005-05-10 20:34 ` Lee Revell
2005-05-10 21:18   ` Andre Eisenbach
2005-05-10 20:38 ` Lee Revell
2005-05-10 20:45 ` Matthias-Christian Ott
2005-05-10 21:16   ` Andre Eisenbach
2005-05-10 21:29     ` Lee Revell
2005-05-10 21:41       ` Andre Eisenbach
2005-05-10 21:53 ` George Anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox