Re: [CFR] Replacing while loops with proper division and multiplication

2015-06-05 Thread Neel Natu
Hi Hans, On Fri, Jun 5, 2015 at 11:53 AM, Hans Petter Selasky wrote: > On 06/05/15 20:31, Neel Natu wrote: - runs = 0; >>- while (now >= state->nexthard) { >>- state->nexthard += tick_sbt; >>- runs++; >>- } >>-

Re: [CFR] Replacing while loops with proper division and multiplication

2015-06-05 Thread Hans Petter Selasky
On 06/05/15 20:31, Neel Natu wrote: - runs = 0; >>- while (now >= state->nexthard) { >>- state->nexthard += tick_sbt; >>- runs++; >>- } >>- if (runs) { >>+ runs = (now - state->nexthard) / tick_sbt; >>+ if (runs > 0) { >>+

Re: [CFR] Replacing while loops with proper division and multiplication

2015-06-05 Thread Neel Natu
Hi Hans, On Fri, Jun 5, 2015 at 12:09 AM, Hans Petter Selasky wrote: > Hi, > > I was going through some timer code and found some unnecessary while loops > in kern/kern_clocksource.c . > > I added some prints and found that during boot, "runs" can exceed 2000, > while during regular usage runs is

Re: [CFR] Replacing while loops with proper division and multiplication

2015-06-05 Thread Konstantin Belousov
On Fri, Jun 05, 2015 at 09:09:26AM +0200, Hans Petter Selasky wrote: > Hi, > > I was going through some timer code and found some unnecessary while > loops in kern/kern_clocksource.c . > > I added some prints and found that during boot, "runs" can exceed 2000, > while during regular usage runs

[CFR] Replacing while loops with proper division and multiplication

2015-06-05 Thread Hans Petter Selasky
Hi, I was going through some timer code and found some unnecessary while loops in kern/kern_clocksource.c . I added some prints and found that during boot, "runs" can exceed 2000, while during regular usage runs is typically 1. Do you think it is worth to convert these loops into division an