Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: X11 simulator clock runs too fast
From: c s (rb_dev_at_yahoo.com)
Date: 2003-03-07


--- Daniel Stenberg <daniel_at_haxx.se> 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) {
    do_something();
    sleep(some_num_ticks);
}

...so 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
10.

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
http://taxes.yahoo.com/



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa