Re: [LAD] Library for accurate time stamping using a DLL

From: Stefan Kost <ensonic@email-addr-hidden-obscura.de>
Date: Tue Jan 27 2009 - 09:22:01 EET

Olivier Guilyardi schrieb:
> Hi everyone,
>
> Fons, thanks to your essay "Using a DLL to filter time" [1], that you mentionned
> in a discussion we had in August, I've put together a small library, named
> Pendule, for accurate timing within a real time context. It's a tiny piece of
> code, but offers a very easy to use replacement for gettimeofday().
>
> Plus, it includes some benchmarking/measuring tools, that produce that sort of
> fancy graphics (this one using a PCI hda intel card):
> http://www.samalyse.com/code/pendule/shortgraph.png
>
> Usage is very simple. first create an instance:
> #include <pendule.h>
> Pendule *pendule = pendule_new(buffer_size / sample_rate, bandwidth);
>
> Then, in the realtime thread, update the loop every process cycle:
> pendule_cycle(pendule);
>
> And use pendule_gettime() instead of gettimeofday():
> double current_time_in_seconds = pendule_gettime(pendule);
>
> As expected, looking at the graph above, the obtained time doesn't drift as the
> audio time, and has a lower jitter than the system time. Well, at least, it
> works for me.
>
> However, although my measures are pretty encouraging, I am not 100% sure of my
> DLL implementation. Could you please review it ? It's there:
> http://svn.samalyse.com/pendule/trunk/src/pendule.c
>
hi

instead of gettimeofday() you could use
clock_gettime(CLOCK_MONOTONIC,..) where its available. Its a posix
function and it has the benefit of beeing monotonic, where
gettimeofday() is imho useless if you run ntp.

also in _new() you should probably use calloc, or make sure you init all
fields.

Stefan
> You can grab everything using svn:
> svn co http://svn.samalyse.com/pendule/trunk pendule
>
> I'd like to know how it works for others. You can easily test your
> hardware/system and make graphs with:
>
> ./waf configure
> ./waf build
> ./measure
> ./graph
>
> Check the README for more.
>
> [1] http://www.kokkinizita.net/papers/usingdll.pdf
>
> Best regards,
>
>

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Tue Jan 27 12:15:02 2009

This archive was generated by hypermail 2.1.8 : Tue Jan 27 2009 - 12:15:03 EET