/* Approximate loops_per_tick as the largest power-of-two
still less than one timer tick. */
loops_per_tick = 1u << 10;
- while (!too_many_loops (loops_per_tick << 1))
- loops_per_tick <<= 1;
+ while (!too_many_loops (loops_per_tick << 1))
+ {
+ loops_per_tick <<= 1;
+ ASSERT (loops_per_tick != 0);
+ }
/* Refine the next 8 bits of loops_per_tick. */
high_bit = loops_per_tick;
void
timer_print_stats (void)
{
- printf ("Timer: %"PRId64" ticks\n", ticks);
+ printf ("Timer: %"PRId64" ticks\n", timer_ticks ());
}
\f
/* Timer interrupt handler. */
differently in different places the results would be difficult
to predict. */
static void NO_INLINE
-busy_wait (int64_t loops)
+busy_wait (volatile int64_t loops)
{
while (loops-- > 0)
continue;