View Single Post
Posts: 156 | Thanked: 44 times | Joined on Dec 2007
#74
Originally Posted by micampe View Post
I noticed that your version is much more CPU intesive that the original. And I imagine that loop where you wait for the flag could be the culprit.
Hmmm, is it?

I might turn up the usleep delay in the loop. Come to think of it, the printf I stuck in there to report how much it was delaying was probably delaying itself. I'll count how many cycles that loop actually goes through (I know usleep(5) isn't right...).

Is the CPU usage higher when you're not touching anything?

Edit: the system seems to sleep a little longer than 5 microseconds. That loop is not executing more than once or twice, and even then only immediately after when you put the mouse down to the next tick. Are you sure it's this?

Last edited by t3h; 2008-02-12 at 23:53.