https://bugs.linaro.org/show_bug.cgi?id=3787

--- Comment #2 from Josep Puigdemont <josep.puigdem...@linaro.org> ---
There is no problem with ODP timers, the timers are delivered at the expected
tick. It is in fact the test application that is at fault here, which does not
calculate the tick correctly.

In the proposed example, 20 ms tick, 210 ms period, we should expect a timeout
every 10.5 ticks, however the application rounds this up to 10 ticks. The error
is then carried in subsequent timeouts, which are all delivered late,
exacerbating this rounding error the more timeouts we request.

Timeout num -> expected tick for tmo -> requested tick for tmo
0 -> 0 -> 0 (always on time)
1 -> 10.5 -> 10
2 -> 21 -> 20
3 -> 31.5 -> 30
...
19 -> 199.5 -> 190

Then when checking if we got the timeout at the right time, we look at the wall
clock, were we see that time has passed more slowly for ODP, and it's not
exactly because it's been travelling close to the speed of light.

In this example with 20 timeouts, in the worse case the error is almost 50% the
resolution of the timer (9.5ms/20ms), and averaged should be around 5, which
explains exactly the results I get:

$ ./example/timer/odp_timer_accuracy -p 210000000 -r 20000000 -n 20
 Test results:
  num after:             1  /  5.00%
  num before:           19  /  95.00%
  num exact:             0  /  0.00%
  error after (nsec):
         min:        77417  /  0.004x resolution
         max:        77417  /  0.004x resolution
         ave:        77417  /  0.004x resolution
  error before (nsec):
         min:     10004401  /  0.500x resolution
         max:    189970753  /  9.499x resolution
         ave:     99993722  /  5.000x resolution

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.

Reply via email to