Realtime Embedded Linux
preempt-rt
project in the t3gemstone/examples repository is a benchmarking tool designed to test real-time task performance on the Linux Preempt-RT kernel. The program’s main purpose is to measure latency and jitter—critical metrics in real-time systems—to analyze system performance. The application simulates a task running at a 1-millisecond period, evaluating how consistently and predictably it executes.
The program works by first creating a real-time thread using the SCHED_FIFO
scheduling policy and assigning it a high priority (priority 80). This thread simulates a task that should run every 1ms, using the clock_nanosleep()
function for precise timing. Additionally, the program locks memory pages in RAM using mlockall()
to prevent page faults and reduce delays. Over 10,000 iterations, it collects performance data, measuring the difference between expected and actual wake-up times (latency) and the consistency of the period (jitter).