[Olsr-dev] Timing Bug in the Scheduler, with Patch
Wed Jan 30 16:17:08 CET 2008
nice catch, many thanks !
added to CVS and HG.
Andreas Jacobs wrote:
> I've found a bug in the scheduler that makes the scheduler poll less
> often than it should.
> 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.
> - 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'
More information about the Olsr-dev