Skip to contentSkip to conversation

High res timer?

DISCUSSION Andre Eisenbach 4 participants 9 messages May 10, 2005 – May 11, 2005

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 6 lines · Andre Eisenbach

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

#2 lore raw

2005/5/10, Lee Revell <[email protected]>:

Quoted 4 lines · Andre Eisenbach

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

I'll look into this.

Oh, and sorry for the off-topic :(

Thanks,
Andre

#3 lore raw
In reply to Andre Eisenbach
Quoted 7 lines · Andre Eisenbach

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

#4 lore raw
In reply to Andre Eisenbach
Quoted 7 lines · Andre Eisenbach

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?

Quoted 8 lines

Thanks,
Andre
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
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

#5 lore raw

2005/5/10, Matthias-Christian Ott <[email protected]>:

Quoted 3 lines

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

#6 lore raw
Quoted 5 lines · Andre Eisenbach

2005/5/10, Matthias-Christian Ott <[email protected]>:

Quoted 3 lines

What about nanosleep ()?

Quoted 8 lines

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

#7 lore raw

2005/5/10, Lee Revell <[email protected]>:

Quoted 7 lines
Quoted 5 lines

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

#8 lore raw
In reply to Andre Eisenbach
Quoted 6 lines · Andre Eisenbach

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.

Signature · 2 lines
George Anzinger   [email protected]
High-res-timers:  http://sourceforge.net/projects/high-res-timers/