Listing 15: (a) RTLinux FIFO test; (b) RTLinux FIFO output.

(a)
rtl_no_interrupts(flags);
clock_gettime(clock_REALTIME, &start);
rtf_put(rtl_fds[fd].f_priv, buf, size);
clock_gettime( clock_REALTIME, &end);

clock_gettime(clock_REALTIME, &start);
for (j = 0; j < num_runs; j++)
   rtl_write(fd, buf, size);
clock_gettime(clock_REALTIME, &end);
rtl_restore_interrupts(flags);

(b)
FIFO Latency:
15 NULL rtl_write() took 22.7 us
15 NULL rtl_write() took 17.6 us
15 NULL rtl_write() took 17.3 us
15 NULL rtf_put() took 8.6 us
15 NULL rtf_put() took 8.4 us
15 NULL rtf_put() took 8.6 us

15 128b rtl_write() took 56.6 us
15 128b rtl_write() took 31.7 us
15 128b rtl_write() took 32.5 us
15 128b rtf_put() took 23.8 us
15 128b rtf_put() took 10.0 us
15 128b rtf_put() took 5.1 us