In the previous part we’ve applied the real time patch to the kernel and compiled the required modules. Now, we will test the latency of the system and the I2C support.
Latency benchmark
The latency test should display a message every second with minimal, maximal and average latency values.
root@x3n0B0mb:~# echo 0 > /proc/xenomai/latency
root@x3n0B0mb:~# latency -p 100
== Sampling period: 100 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
RTT| 00:00:01 (periodic user-mode task, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| 2.000| 3.000| 17.000| 0| 0| 2.000| 17.000
RTD| 3.000| 4.000| 23.000| 0| 0| 2.000| 23.000
RTD| 3.000| 4.000| 21.000| 0| 0| 2.000| 23.000
RTD| 3.000| 4.000| 22.000| 0| 0| 2.000| 23.000
RTD| 3.000| 4.000| 20.000| 0| 0| 2.000| 23.000
RTD| 3.000| 4.000| 25.000| 0| 0| 2.000| 25.000
RTD| 2.000| 3.000| 24.000| 0| 0| 2.000| 25.000
RTD| 2.000| 3.000| 21.000| 0| 0| 2.000| 25.000
RTD| 3.000| 4.000| 25.000| 0| 0| 2.000| 25.000
RTD| 3.000| 4.000| 23.000| 0| 0| 2.000| 25.000
RTD| 3.000| 4.000| 24.000| 0| 0| 2.000| 25.000
RTD| 3.000| 4.000| 22.000| 0| 0| 2.000| 25.000
RTD| 3.000| 4.000| 23.000| 0| 0| 2.000| 25.000
RTD| 3.000| 4.000| 25.000| 0| 0| 2.000| 25.000
RTD| 3.000| 4.000| 27.000| 0| 0| 2.000| 27.000
RTD| 3.000| 4.000| 20.000| 0| 0| 2.000| 27.000
RTD| 3.000| 4.000| 18.000| 0| 0| 2.000| 27.000
RTD| 3.000| 4.000| 21.000| 0| 0| 2.000| 27.000
RTD| 3.000| 4.000| 21.000| 0| 0| 2.000| 27.000
RTD| 2.000| 3.000| 24.000| 0| 0| 2.000| 27.000
#
As we can see from the above command, the system has a 3 microsecond latency and a maximum of 27. If we stress the system and leave it for a few hours we won't get more than 40 microseconds latency.
Testing the I2C support
root@x3n0B0mb:~# modprobe i2c-bcm2708
root@x3n0B0mb:~# modprobe i2c-dev
root@x3n0B0mb:~# lsmod
Module Size Used by Tainted: G
i2c_dev 5931 0
i2c_bcm2708 4074 0
root@x3n0B0mb:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@x3n0B0mb:~#
If nothing is connected to the Raspberry Pi the grid should be empty.