dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: X11 simulator clock runs too fast

Re: X11 simulator clock runs too fast

From: c s <>
Date: Thu, 6 Mar 2003 17:42:23 -0800 (PST)

--- Daniel Stenberg <> wrote:
> On Thu, 6 Mar 2003, Jerry Van Baren wrote:
> > There is a high resolution timer patch for linux:
> > It works very well. I don't know if it has been
> accepted into the
> > mainstream kernel yet.
> As I was saying, we should not write anything to
> depend on any kind of high
> resolution timers in the simulator. It would be
> totally pointless and counter
> productive.

You are right. There isn't much of a point trying to
make the simulator clock highly accurate since some or
all of the periodic rockbox threads are of the form:

while(1) {
} the period of the task in terms of ticks depends
both on how long it takes to execute the
do_something() on the simulator hardware as well as
the accuracy the clock emulation. Even with a highly
accurate simulated tick, the period of rockbox tasks
can differ still differ depending on the speed of the
simulator the code is running on.

That being said, it is still desirable to try to
achieve a somewhat accurate tick in the simulator if
we can do it without making the simulator code
non-portable. Currently it runs 10 times too fast, on
the system I run on, so all the places in the rockbox
code that check on an elapsed time by doing
"TIME_AFTER(current_tick, xxx)" are off by a factor of

When I change the increment value in x11_sleep form 5
to 'tics', then current_tick runs about 3 times too
fast (because of the problem that I discussed earlier
where multiple threads can be in a sleep call and all
will be incrementing current_tick).

The best quick fix seems to be to change the increment
value in x11_sleep from 5 to 1. This works fairly well
because no matter what rockbox is doing, there is
always a thread doing constant calls to
button_get_w_timeout which does multiple calls of
sleep(1) to do its timeout.

Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
Received on 2003-03-07

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy