[squeak-dev] message send logging VM

John M McIntosh johnmci at smalltalkconsulting.com
Wed Apr 16 20:28:32 UTC 2008


Via a request from David Röthlisberger

I've updated the special VM I had created to do message logging it's  
found via the experimental folder, in folder MessageLoggingVM
on my .mac idisk or ftp from http://www.smalltalkconsulting.com/squeak.html

Squeak 3.8.18beta3UXXX.app.zip

This special VM based on the 3.8.18b3 carbon VM that logs the call  
stack on each message send.  Because logging occurs at
VM message send time it gives a very accurate picture of what the  
image is doing, and also generates gigabytes of data.

Once you load the programming api change sets, usage is:

Smalltalk setVMStatsTraceMessageSendLevels: 1.

to set message send recording on.  Note that you pass an integer so  
you can say

Smalltalk setVMStatsTraceMessageSendLevels: 5.

to set the number of levels in the call stack to print to 5.

Smalltalk setVMStatsTraceMessageSendLevels: 0.

turns the recording off, and closes the file, the file is always  
opened truncated writing.

b) Or a kill signal to turn recording on/off and alter recording levels.

kill -USR1 19278  {Pick a squeak VM process id}

kill -USR1 19278  {increment the level by one, go to 2}
kill -USR1 19278  {increment the level by one, go to 3}

kill -USR2 19278  {turn recording off, and close the file}

As a reminder David T Lewis also provided change sets to allow the  
interfacing to OSProcess
if you wish to rebuild a VM with this feature and use OSProcess for  
more control.


> VMStatsTraceControl-dtl
>
> Add VMStatsTraceControl to provide the signal handlers for SIGUSR1 and
> SIGUSR1 controlling VM stats log. Sending a SIGUSR1 signal to the  
> Squeak
> process increments the logging level, and SIGUSR2 disables logging and
> closes the file.
>
> Requires OSProcess for the signal handling (but relevant methods can  
> be
> copied into VMStatsTraceControl if you don't want to require OSP). The
> signal handling primitive is in OSPP, currently distributed with the
> Unix VM, or load OSProcessPlugin from SqueakMap.
>
>
> VMStatsInterpreterChanges-dtl
>
> Interpreter changes to accompany VMStatsTraceControl-dtl. This removes
> the SIGUSR1 and SIGUSR2 signal handlers from the interpreter so they
> can be handled in the image.
>
> Load this after JMMRecordMsgSends and JMMRecordMsgSendInterface.
> Also load VMStatsTraceControl-dtl.
>
> Interpreter changes:
> - Removed #cCode: (interrupt handlers) from  
> Interpreter>>initVmStatsTraceMessageSendLevels.
> - Added Add Interpreter>>primitiveGetVMStatsTraceMessageSendLevels.
> - Added SystemDictionary>>getVMStatsTraceMessageSendLevels
> - Fixed assignment bug in  
> Interpreter>>primitiveSetVMStatsTraceMessageSendLevels (change '='  
> to ':=').


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





More information about the Squeak-dev mailing list