FW: Accuracy of rtems_timer_server_fire_after

Mogens Dybæk Christensen MogensD.Christensen at man.eu
Wed Jul 4 09:38:18 UTC 2012


Does the server task behind these delays run at clock tick speed, or is the timing scaled down?

I am working on a C++ wrap for timers, where rtems_timer_server_fire_after fits nicely.

There is also a task wrap, that uses rtems_task_wake_after to implement delays in the current task. That one has existed for some time, and I use it to test the new timer wrap.

Apparently rtems_task_wake_after is more accurate than rtems_timer_server_fire_after. - My test program uses the first to validate that the other has fired. I have to make very loose timing to get that test working.

I have inserted calls to rtems_clock_get_uptime in the code, so I can estimate the relative timing of the threads.

The system tick is 1 mS, but if (as an extreme test) rtems_timer_server_fire_after is fed with a 1 tick delay, the callback routine is called after approx. 29 mS! rtems_task_wake_after nicely implements a 20 mS delay as a little more than 19 mS.

Please give a hint, if I am using the timer server for something it was not designed for. We can't directly use rtems_timer_fire_after, because some legacy code assumes to run in a task context. - 10 mS resolution should be sufficient.

Tests done on QEMU x86 with RTEMS 4.11. Setting the server priority to 1 (highest) does not change much.

Mogens Dybæk Christensen
Software Engineer
LDE5, Electronics & Software, Basic Software Platform
MogensD.Christensen at man.eu<mailto:MogensD.Christensen at man.eu>, +45 3385 2362
MAN Diesel & Turbo SE, Copenhagen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20120704/1efe747a/attachment.html>

More information about the users mailing list