[ENH]Utility to show all Processes
Mark A. Schwenk
mas at wellthot.com
Thu Jul 29 02:38:37 UTC 1999
The first version I sent out was susceptible to having garbage processes build up before the process list was iterated over. I have added a Smalltalk garbageCollect just before the list is printed to fix this problem. I'm sorry for the aggravation I may have cause others (and myself!).
"Mark A. Schwenk" wrote:
>
> Here is a simple utility I have written to display the stack of all Processes.
>
> Someday it would be nice to extend this with a Morphic interface that could show the processes sorted in descending order by CPU usage, allow you to suspend processes, resume processes, terminate processes, connect to process with the debugger, etc.
>
> In the meantime, perhaps this will be useful to someone else, especially if you are running the multi-threaded PWS server and want to keep track of your processes.
>
> After filing in, execute
>
> Utilities processes
>
> to open a workspace showing the entire stack of each process.
>
> -Mark Schwenk
> WellThot Inc.
'From Squeak 2.4c of May 10, 1999 on 28 July 1999 at 9:31:09 pm'!
!ContextPart methodsFor: 'debugger access' stamp: 'mas 7/1/1999 22:38'!
entireStack
"Answer a String showing all contexts on my sender chain."
| stackStream |
stackStream _ WriteStream on: (String new: 55*30).
(self stack) do:
[:item | stackStream print: item; cr].
^stackStream contents! !
!Utilities class methodsFor: 'support windows' stamp: 'mas 7/28/1999 21:30'!
processes
| s |
s _ WriteStream on: (String new: 1000).
Smalltalk garbageCollect.
Process allInstances do: [ :p |
p suspendedContext ifNotNil: [
s
nextPutAll: (p suspendedContext entireStack);
cr]].
(StringHolder new contents: s contents)
openLabel: 'Processes'
! !
More information about the Squeak-dev
mailing list
|