Squeak is doing a *lot* of gettimeofday()

John M McIntosh johnmci at smalltalkconsulting.com
Tue Feb 12 06:00:31 UTC 2002


>gettimeofday({1013465648, 162274}, NULL) = 0
>(repeated until I stop the process).
>I'm able to work with squeak, but on my Internet server, it eats a
>lot of CPU-time, and I think this comes from these calls.
>
>Thank you,
>		Markus Fritsche
>

If you look at the source code sqXWindow.c you'll see some logic around
USE_ITIMER which uses   sigaction(SIGALRM, &sa, 0); and 
setitimer(ITIMER_REAL, &iv, 0); to trigger a sig alarm every 20 msecs 
to update a low resolution ms clock. That clock as you can see gets 
called a lot. Upwards of 40,000 times a second on a fast machine.

But turning ITIMER on means  all system calls must check for EINTR, 
which I  don't think they do so there are side effects.

Under os-x (a bsd unix) I tried it and had problems with sound 
recording. So I've reverted to logic which uses pthread logic to do a 
periodic run every N milliseconds to fetch the clock value into a ms 
timer.


Sooooo I'm wondering if any of the unix folks that have PTHREAD 
support should/could/would look into that type of logic. The timer 
mostly needs to be somewhat accurate, kinda. But it gets looked at a 
*lot*.

Although some u***x don't support this feature, one should take 
advantage of it if it's there to improve performance.

-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list