[squeak-dev] Re: CPU of headless Squeak Image

John M McIntosh johnmci at smalltalkconsulting.com
Wed Feb 18 19:19:45 UTC 2009


well Project uiProcess suspend  deals with the Morphic UI process  
which is polling events from the UI event queue and running morphic  
subclass step cycles,

You can test the effect of doing a Project uiProcess suspend in a test  
image, you'll note all mouse interaction etc stops. So that is NOT  
consuming cpu cycles.


What you can do is attach to the running application with Gnu debug  
then stop it, and then invoke
call (int) printAllStacks()  and example the output, that will be the  
stack trace of all running processes.

They should all be waiting in some delay

except for the   idle loop process which will run from time to time to  
service async services via aioPoll()
The behaviour of this is tie to what should code you are using, you  
would need to look at the source code to see what the behaviour is
for your platform, I note there have been different versions over the  
years.  In general it *should* be waiting until the next smaltlalk  
delay expires or
an external interrupt comes in (clock signal, socket traffic, etc).   
Other code flavours if the wait time is < 10 ms might not wait, or  
maybe do a fixed amount of time.

BTW you will get GC work if you are executing smalltalk code, when,  
how often, and how long that takes is all a factor of the GC parms,
you data shows the incremental GC is executing every two seconds which  
is nothing for a GC rate, also it accounting for only 0.0003 % of  
clock time per second.


relinquishProcessorForMicroseconds: anInteger
	"Platform specific. This primitive is used to return processor cycles  
to the host operating system when Squeak's idle process is running  
(i.e., when no other Squeak process is runnable). On some platforms,  
this primitive causes the entire Squeak application to sleep for  
approximately the given number of microseconds. No Squeak process can  
run while the Squeak application is sleeping, even if some external  
event makes it runnable. On the Macintosh, this primitive simply calls  
GetNextEvent() to give other applications a chance to run. On  
platforms without a host operating system, it does nothing. This  
primitive should not be used to add pauses to a Squeak process; use a  
Delay instead."


On 18-Feb-09, at 6:53 AM, Udo Schneider wrote:

> Michael Rueger schrieb:
>> Squeak usually takes about 2-5% in my experience (due to some  
>> polling loops within the VM).
>> Make sure you have no UI windows open before you save the image,  
>> even in headless state that can cause CPU usage.
> Thanks for the hint - just tried this with no luck. :-(
>
> I usually have an "Project uiProcess suspend" at the end of my  
> startup script - do I still have to close the windows then?
>
> Just took a look at /config and it seems that IMHO the GC is running  
> quite often (two times a second). However even if I increase the  
> heap it stays with 15% ...
>
> uptime			0h39m0s
> memory			30,628,388 bytes
> 	old			26,569,316 bytes (86.7%)
> 	young		62,128 bytes (0.2%)
> 	used		26,631,444 bytes (87.0%)
> 	free		3,996,944 bytes (13.0%)
> GCs				4,652 (503ms between GCs)
> 	full			2 totalling 1,496ms (0.0% uptime), avg 748.0ms
> 	incr		4650 totalling 15,179ms (1.0% uptime), avg 3.0ms
> 	tenures		18 (avg 258 GCs/tenure)
>
> Any pointers?
>
> CU,
>
> Udo
>
>

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






More information about the Squeak-dev mailing list