Last updated at 8:35 pm UTC on 19 October 2017
The Process Browser is a handy tool for analyzing processes running within Squeak. To open one, from the World menu, go to the "debug..." submenu and select "open process browser".
To see live updating of processes and cpu usage within Squeak, turn on "auto update" and "CPUWatcher" from the pop-up menu of the Process Browser – which you'll find by alt-clicking in the top left pane of the browser.
If you have the CPUWatcher turned on, it will also watch for runaway high-priority (Squeak) processes which would normally make the UI freeze up. Instead, it catches these runaway processes and asks if you want to terminate/resume/debug them. (If you're having problems with Squeak freezing or the UI slowing way down, you may want to turn it on.)
For example, if you first turn on the CPUWatcher (be sure to turn it on for this example!), then try to execute the following code in a Workspace:
[50000 timesRepeat: [100 factorial]] forkAt: 70
If you did not have the CPUWatcher turned on, the UI would be unresponsive until this process finished (which might take a minute or two). But if it's on, a menu should pop up (after several seconds) asking what you want to do with the process.
(Bump up to 500000 if this does not work on your configuration)
Why in the world is the UI using so much time?
Easy way to do this:
- open a Process Browser
- start CPU watcher
- turn on the auto-update
- don't move the mouse. (see Note 1)
- Then, select the UI process.
- Open the context menu and choose "profile messages". Give it 10 seconds or so.
You should see where the time is going.
Note 1: The UI process should be way down in the percentage numbers (less than 10%). If it isn't, try closing all other windows, deleting Morphs, making flaps disappear, etc.
Note 2: By the way, I've found that changing the 16 msec interval in MessageTally class>>spyOnProcess:forMilliseconds: (and spyOn:) to 1 msec improves the resolution considerably. (Ned Konz)