[Newbies] Is there a way to watch all the messages flowing in Squeak?

Ned Konz ned at bike-nomad.com
Wed Oct 18 17:11:56 UTC 2006

andy.burnett at knowinnovation.com wrote:
> Although everything in Squeak is open, I find it quite hard sometimes to 
> track down what is calling what.  It would be great if I could open up a 
> window to see which object is being called when I e.g. right click on 
> the surface and bring up the World menu etc.
> Is there some way to turn on the debugger and just let it run, or 
> something like that?

Debugging the UI is tricky, because the debugger uses the UI. But you 
can see what methods get called using the profiler.

For instance, you can do this in a Workspace to debug the Morphic UI for 
4 seconds (4000 msec):

now := Time millisecondClockValue.
TimeProfileBrowser spyOn: [ [ Time millisecondClockValue - now > 4000 ] 
whileFalse: [ World doOneCycleNow ] ]

After 4 seconds, you will see a TimeProfileBrowser pop up that will show 
what messages were called, and how many times. This works by 
interrupting the execution of the block given to spyOn: every 
millisecond or so, so it can miss methods that don't get called very 
often or are very fast.

You can also use the simulator to run code; this is much slower, but 
won't miss anything. Note that some primitives (for instance, in the 
BalloonEngine) won't simulate properly.

now := Time millisecondClockValue.
MessageTally tallySends: [ [ Time millisecondClockValue - now > 20000 ] 
whileFalse: [ World doOneCycleNow ] ]

Ned Konz
ned at bike-nomad.com

More information about the Beginners mailing list