[Olsr-dev] Timing Bug in the Scheduler, with Patch

Andreas Jacobs (spam-protected)
Wed Jan 30 16:03:12 CET 2008


Hi,

I've found a bug in the scheduler that makes the scheduler poll less  
often than it should.

Reason:
After each iteration of the scheduler's main loop the scheduler  
calculates, how much time this iteration took, and then sleeps for  
the rest of the scheduler interval. The bug lies in the calculation  
of the elapsed time, which is converted from a tick count to a  
'struct timeval' which consists of a seconds value and a microseconds  
value. The seconds are filled in correctly, but the microseconds  
field is filled a milliseconds value instead of a microseconds value.

Consequently the elapsed time is always underestimated and afterwards  
the scheduler sleeps too long.

Patch:
- against recent mercurial revision (0fc82e1fb7ee)
- introduces a new variable milliseconds to avoid calulation the  
milliseconds twice, as it is currently
- corrects the line which sets the 'tv_usec' (microseconds) field of  
the 'struct timeval time_used'

Regards
Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: olsrd.scheduler.patch
Type: application/octet-stream
Size: 1011 bytes
Desc: not available
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20080130/4b17af99/attachment.obj>
-------------- next part --------------




More information about the Olsr-dev mailing list