[linux-audio-dev] gettimeofday() realtime safe?

David Olofson david at olofson.net
Thu Apr 21 09:28:33 UTC 2005


On Thursday 21 April 2005 07.45, Jack O'Quin wrote:
[...]
> > Is calling gettimeofday this many times in the realtime thread a
> > wise idea?
> 
> How often?  Once per MIDI event?  That should be OK, I suppose.

I did a quick hack for testing some custom hardware on an embedded 
system, where I just polled gettimeofday() to get some code to run at 
10 kHz. (Didn't care about the occasional stalls - which were very 
few anyway, as this was the only process actually doing anything at 
the time.) That is, a bunch of gettimeofday() calls for each loop, 
times 10 kHz. Worked just fine.

This was on a 300 MHz low power Pentium clone, which has about 10-15% 
of the power of a 1 GHz P-III CPU. I'm not even sure if Linux is 
using RDTSC for gettimeofday() on this thing...


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---



More information about the Linux-audio-dev mailing list