User Tools

Site Tools


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

This is an old revision of the document!


Cyclictest - Use clock_nanosleep( )

Cyclictest uses threads that wake up periodically to measure a system's latencies. The nanosleep option (–nanosleep) means 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, this option should always be used when running Cyclictest because the wake-up latency experienced by the Cyclictest measuring threads after their timer expires will be 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 wakeup 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.1535022501.txt.gz · Last modified: 2018/08/23 11:08 by ebugden