This is very similar to a problem I solved when I was testing disk I/O subsystems and needed to generate I/O requests at fixed intervals of a few hundred per second. What I did was to take a timestamp at the beginning of the test and set up a loop with a sleep in it. The initial sleep value was just 1/desired_rate and then I adjusted the sleep value each time the process woke up to keep the average rate constant over the current_time - timestamp interval. This algorithm converged quickly and the jitter was quite small. I can probably find/ post the C code if you'd like to see it.
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en