Squeak is doing a *lot* of gettimeofday()

Scott A Crosby crosby at qwes.math.cmu.edu
Tue Feb 12 11:01:30 UTC 2002


On Mon, 11 Feb 2002, Markus Fritsche wrote:

> Hello,
>
> When I start squeak under Linux

> and make an strace, I'll get lots of
> gettimeofday({1013465648, 161481}, NULL) = 0
> gettimeofday({1013465648, 161564}, NULL) = 0
> gettimeofday({1013465648, 161660}, NULL) = 0
> gettimeofday({1013465648, 161742}, NULL) = 0


Been there, done that, reported it about 6 months ago. Squeak runs about
40k gettimeofday's per second. Those timechecks are done in
primitiveResponse, as it checks *all primitives* to see if they take too
long (so-ask to make sure to interrupt the current squeak process if its
time for the next timeslice.

Although John's solution works, its not the ideal; it makes the checks a
little cheaper, but does not remove them. This still leaves behind a
noticable overhead. While, THIS:

  Date: Fri, 14 Dec 2001 02:31:15 +0100
  From: Andreas Raab <Andreas.Raab at gmx.de>
  Reply-To: squeak-dev at lists.squeakfoundation.org
  To: squeak-dev at lists.squeakfoundation.org
  Subject: RE: fetchClassOf & commonSend?

would appear to cut down on the checks in the first place; we know that
most primitives are fast, no matter what, so we don't check the time when
doing them. Thus cuts down on the checks by about 10x. (Most of the
remaining checks are actually coming from the smalltalk side.)

The ideal fix is Andreas's patch, with ITIMER as a backup... Which is good
for about 5% overall.

I've not tested Andreas's patch, mainly because it touches a lot of parts
of the VM, very simply, but it does. Also, many of those changes would
have to be repeated for BC. Rather than do it twice, I'd say to do it
once, and do it in the BC VM. I'm creating a little hints-tricks list for
stuff that makes the VM go faster.

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

It eats a lot of time regardless, much of it in what appears to be
busywait loops.

Scott





More information about the Squeak-dev mailing list