[Newbie question| timer modes
I am trying to compare latencies between one-shot mode and periodic mode. Is there a way to get the system's time expressed in nanoseconds if I set the timer to periodic?
Thanks,
Rodolfo Bamberg
Quoted 3 lines · Rodolfo Bamberg
I am trying to compare latencies between one-shot mode and periodic mode. Is there a way to get the system's time expressed in nanoseconds if I set the timer to periodic?
With the native API, use rt_timer_tsc and rt_timer_tsc2ns to convert to nanoseconds. With the posix API, use clock_gettime(CLOCK_MONOTONIC). Note that what you get is not exactly the system time, but rather the TSC time, its origin is around the time of the boot, but it is sufficient for measuring time differences.
Also note that measuring the latency in periodic mode makes little sense, you will get a variable offset due to the fact that the periodic task wake up times are aligned on the system timer ticks.
Signature · 1 line
Gilles Chanteperdrix