Re: Setitimer() resolution?
Alex, Yes, I'm developing an audio application that'd greatly benefit from 1ms or greater precision. I'll look into both those options. Thanks, Paul S. Original Message On Dec 14, 2018, 20:02, Alexandre Ratchov wrote: > On Thu, Dec 13, 2018 at 09:27:12PM +, Paul Swanson wrote: >> Hi, >> >> I'm trying to understand how interval timers work in OpenBSD, >> but I'm a little stuck on this line from the getitimer / setitimer man page: >> >> "Time values smaller than the resolution of the system clock >> are rounded up to this resolution (typically 10 milliseconds)." >> >> Does this mean that 10 milliseconds is the shortest interval possible >> with a system interval timer? >> >> If so, are there other userland options for more precise timers? >> > > What would need a more precise timer? with what resolution? > > On amd64, you could build a kernel with HZ=1024, which gives a timer > that ticks every 1ms. I use this since ~2005 for MIDI programs. > > If the program that needs a precise timer involves audio, you could > also use the sound card clock instead. For instance by running sndiod > with "-z 120" option then call your code in the sio_onmove(3) > call-back. The advantage of this approach is that you get a unique > clock source, which avoids may problems.
Re: Setitimer() resolution?
On Thu, Dec 13, 2018 at 09:27:12PM +, Paul Swanson wrote: > Hi, > > I'm trying to understand how interval timers work in OpenBSD, > but I'm a little stuck on this line from the getitimer / setitimer man page: > > "Time values smaller than the resolution of the system clock > are rounded up to this resolution (typically 10 milliseconds)." > > Does this mean that 10 milliseconds is the shortest interval possible > with a system interval timer? > > If so, are there other userland options for more precise timers? > What would need a more precise timer? with what resolution? On amd64, you could build a kernel with HZ=1024, which gives a timer that ticks every 1ms. I use this since ~2005 for MIDI programs. If the program that needs a precise timer involves audio, you could also use the sound card clock instead. For instance by running sndiod with "-z 120" option then call your code in the sio_onmove(3) call-back. The advantage of this approach is that you get a unique clock source, which avoids may problems.
Re: Setitimer() resolution?
On Thu, Dec 13, 2018 at 09:27:12PM +, Paul Swanson wrote: > Hi, > > I'm trying to understand how interval timers work in OpenBSD, > but I'm a little stuck on this line from the getitimer / setitimer man page: > > "Time values smaller than the resolution of the system clock > are rounded up to this resolution (typically 10 milliseconds)." > > Does this mean that 10 milliseconds is the shortest interval possible > with a system interval timer? > > If so, are there other userland options for more precise timers? > > I'm mainly interested in AMD64. > > Thanks in advance, > > Paul The resolution of the system clock is governed by hz. man 9 hz On amd64, it's set to 100, which means 10ms. We don't have a tickless model to support arbitrary precision timers. -ml
Setitimer() resolution?
Hi, I'm trying to understand how interval timers work in OpenBSD, but I'm a little stuck on this line from the getitimer / setitimer man page: "Time values smaller than the resolution of the system clock are rounded up to this resolution (typically 10 milliseconds)." Does this mean that 10 milliseconds is the shortest interval possible with a system interval timer? If so, are there other userland options for more precise timers? I'm mainly interested in AMD64. Thanks in advance, Paul