Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
SRE Execution Tracer
Last updated at 4:37 pm UTC on 20 August 2020

Execution tracer

The execution tracer is an instance method implemented at the Object level. You have it available after you have loaded the SRE Object Browser.
 #traceRM:levels:

To avoid getting to much tracing information it is used in combination with:

 self doOnlyOnce: aBlock

Thus to restart the exercise you need to reactivate the 'doOnlyOnce:' again.

This is done with
 Smalltalk at: #OneShotArmed put: true

Note that 'RM' stands for 'Role Modeling'.

Example of tracing calls


Let us asssume we are interested how project preferences are saved when leaving a project and entering a new project.

Change the method
 Preferences class>>allPreferences
to
 allPreferences

       self doOnlyOnce: [self traceRM: self levels: 10].
	
	^preferencesDictionary values

Open a Transcript window.

Execute in a workspace
 Smalltalk at: #OneShotArmed put: true


In a workspace do

 Project current identityHash
This gives you a SmallInteger whose value is related to the identity of the project object, for example 2360597

In a workspace do

 (Project named: 'Test') enter

Replace 'Test' with an actual project name you have in your image.

Choose 'go back' (to previous project).

In the Transcript window you observe the following output

 1  [3892] : Preferences class >> allPreferences {Preferences}
 2  [3892] : Preferences class >> doOnlyOnce:
 3  [3892] : Preferences class >> allPreferences
 4  [2360597] : MorphicProject >> saveProjectPreferences
 5  [2360597] : MorphicProject >> saveState
 6  [236812] : MorphicProject >> enter:revert:saveForRevert:
 7  [236812] : MorphicProject >> enter
 8  [1] : UndefinedObject >> DoIt
 9  [3532087] : Compiler >> evaluateCue:ifFail:
 10  [3532087] : Compiler >> evaluateCue:ifFail:logged:

You observe that for the old project (the one we asked for the object pointer id) the methods
are called and that all preferences are considered.

Another example

ExternalDropHandler class>chooseServiceFrom: aCollection

 chooseServiceFrom: aCollection
	"private - choose a service from aCollection asking the user if  needed"
	
	self doOnlyOnce: [self traceRM: self levels: 10].
 .....

Again do
 Smalltalk at: #OneShotArmed put: true

Then drop a picture file onto the desktop.

SRE_tracing_tool_.png

http://folk.uio.no/trygver/themes/SRE/BabySRE.pdf

See also

MessageSendRecorder (and MethodWrappers)