P545/post/timer_proto/ P545 Embedded & Real-Time Systems

Time-keeping techniques

This code demonstrates the operation of four techniques for using UNIX timer capabilitiesEach of which gives sub-second resolution. They are: the alarm signal, a threaded select call, a POSIX timer, and a nanosleep system call.

Program main.c is configured by selection a #definefor TIMER_TYPE and then invoking make, which produces an executable object, timer_proto

When timer_proto runs, it outputs a stream numbers representing the period discrepancy (in μs, e.g. [TXT]) from the 50 ms target. If the descripency exceeds JITTER_LIMIT_US (default 0) output for that cycle is issued. See the Makefile and README files for more details.

The following are xgraph plots of the four techniques over 256 cycles. These measurement have not been independently verified.

[PDF] alarm signal handler
[PDF] POSIX timer
[PDF] thread using select
[PDF] loop with sleeping
[PDF]all plots superimposed.
[TGZ]compressed, tarchive of this directory

Code documentation: [HTM]