User Tools

Site Tools


realtime:documentation:howto:tools:cyclictest:options:nanosleep

Cyclictest - Use clock_nanosleep( )

Cyclictest uses threads that wake up periodically to measure the system's latencies. The default behavior is that these periodic threads will use function clock_nanosleep( ) to sleep until their next intended execution time instead of using the POSIX interval timers. In general, nanosleep should always be used when running Cyclictest because the wake-up latency experienced by the Cyclictest measuring threads after their timer expires is shorter when using clock_nanosleep( ) than when using the POSIX interval timers.

POSIX interval timers have a slower expiry path than the timers set by clock_nanosleep( ) because the POSIX interval timers are signal based. This means that the POSIX interval timer expiry does not happen directly in hard interrupt context. Instead, their expiry path passes through the hrtimer softirq which is an additional level of indirection. On the other hand, a timer set by clock_nanosleep( ) has a much less expensive expiry path because it does not involve any additional indirection. The clock_nanosleep( ) timer expiry path is just a wake up that is entirely executed in hard interrupt context.

Both the POSIX interval timers and clock_nanosleep( ) support the same timer resolution (nanoseconds). So, in this respect they are equivalent.

realtime/documentation/howto/tools/cyclictest/options/nanosleep.txt · Last modified: 2021/12/02 17:23 by bartwensley