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

Dave Robillard drobilla at connect.carleton.ca
Thu Apr 21 19:11:27 UTC 2005


Hi all,

I need to know if gettimeofday (or one of the other standard time
functions) is okay to use in a realtime jack thread.  I can't find any
information on the net about whether it's deterministic or not (or even
how expensive it is).

Problem is I have an event-based system that pushes events (from
OSC/Midi) into a dequeue, which the audio thread runs through to
execute.  If you flood with events, too many need to be processed per
block, the audio thread takes too long and you get dropouts.

I'd like to be able to only process (non timestamped) events for x% of
the time available to prevent this from happening; so I need to be able
to determine how much time has been eaten by event processing so far.

Is calling gettimeofday this many times in the realtime thread a wise
idea?

Cheers,

-DR-




More information about the Linux-audio-dev mailing list