author | Claus Gittinger <cg@exept.de> |
Thu, 21 Aug 1997 15:41:19 +0200 | |
changeset 1299 | d32b7c160ea2 |
parent 1165 | c5329c0e03dd |
child 1300 | fd0f774f6090 |
permissions | -rw-r--r-- |
52 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
982 | 13 |
SystemStatusMonitor subclass:#ProcessMonitor |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
14 |
instanceVariableNames:'processes hideDead runColor suspendedColor waitColor cpuUsages |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
15 |
showDetail' |
315
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
16 |
classVariableNames:'' |
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
17 |
poolDictionaries:'' |
1053 | 18 |
category:'Monitors-ST/X' |
19 | 19 |
! |
20 |
||
771
5cd10b4845f3
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
21 |
!ProcessMonitor class methodsFor:'documentation'! |
52 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
This view shows smalltalks (light-weight) processes, and also offers |
|
40 |
a popup menu for various useful operations on them. |
|
41 |
Especially 'debug' is useful, to see what a process is currently |
|
42 |
doing. |
|
85 | 43 |
|
52 | 44 |
The information shown is: |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
45 |
id - the numeric id of the process |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
46 |
name - the name (if any) of the process |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
47 |
(the name has no semantic meaning; it exists for the processMonitor only) |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
48 |
state - what is it doing; |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
49 |
wait - waiting on a semaphore |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
50 |
eventWait - waiting on a view-event semaphore |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
51 |
ioWait - waiting on an io-semaphore |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
52 |
timeWait - waiting for a time-semaphore |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
53 |
run - run, but currently not scheduled |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
54 |
active - really running (this info is useless, since at |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
55 |
update time, its always the update process which is |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
56 |
running) |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
57 |
suspended - suspended; not waiting on a semaphore |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
58 |
light - not yet started (i.e. has no stack yet) |
52 | 59 |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
60 |
prio - the processes priority (1..30) |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
61 |
usedStack - the current stack use |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
62 |
totalStack - the stack currently allocated (i.e. the maximum ever needed) |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
63 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
64 |
[see also:] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
65 |
Process ProcessorScheduler |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
66 |
WindowGroup |
983 | 67 |
SemaphoreMonitor |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
68 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
69 |
[author:] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
70 |
Claus Gittinger |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
71 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
72 |
[start with:] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
73 |
ProcessMonitor open |
52 | 74 |
" |
75 |
! ! |
|
76 |
||
771
5cd10b4845f3
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
77 |
!ProcessMonitor class methodsFor:'defaults'! |
19 | 78 |
|
56 | 79 |
defaultIcon |
80 |
|i| |
|
19 | 81 |
|
93 | 82 |
i := Image fromFile:'ProcMon.xbm'. |
56 | 83 |
i notNil ifTrue:[^ i]. |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
84 |
^ super defaultIcon |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
85 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
86 |
"Modified: 23.1.1997 / 02:52:31 / cg" |
208 | 87 |
! |
88 |
||
89 |
defaultLabel |
|
90 |
^ 'Process Monitor' |
|
85 | 91 |
! ! |
92 |
||
93 |
!ProcessMonitor methodsFor:'drawing'! |
|
94 |
||
95 |
titleLine |
|
109 | 96 |
showDetail ifTrue:[ |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
97 |
^ 'id group name state prio usedStack totalStack current-segment switch where'. |
109 | 98 |
]. |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
99 |
^ 'id group name state prio where '. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
100 |
|
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
101 |
"Modified: 3.7.1996 / 13:57:38 / stefan" |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
102 |
"Modified: 28.3.1997 / 16:48:14 / cg" |
85 | 103 |
! |
104 |
||
105 |
updateList |
|
106 |
"update list of processes" |
|
107 |
||
108 |
|newList| |
|
109 |
||
110 |
shown ifTrue:[ |
|
208 | 111 |
showDetail ifTrue:[ |
1299
d32b7c160ea2
in detail: also care for subInstances of process.
Claus Gittinger <cg@exept.de>
parents:
1165
diff
changeset
|
112 |
newList := Process allSubInstances asOrderedCollection. |
208 | 113 |
] ifFalse:[ |
114 |
newList := ProcessorScheduler knownProcesses asOrderedCollection. |
|
115 |
]. |
|
85 | 116 |
|
208 | 117 |
"sort by id - take care of nil ids of dead processes" |
118 |
newList sort:[:p1 :p2 | |
|
119 |
|id1 id2| |
|
85 | 120 |
|
208 | 121 |
(p1 isNil or:[(id1 := p1 id) isNil]) |
122 |
ifTrue:[true] |
|
123 |
ifFalse:[ |
|
124 |
(p2 isNil or:[(id2 := p2 id) isNil]) |
|
125 |
ifTrue:[false] |
|
126 |
ifFalse:[id1 < id2] |
|
127 |
] |
|
128 |
]. |
|
129 |
newList ~= processes ifTrue:[ |
|
130 |
processes := WeakArray withAll:newList. |
|
131 |
self updateStatus |
|
132 |
]. |
|
85 | 133 |
]. |
134 |
updateBlock notNil ifTrue:[ |
|
208 | 135 |
Processor removeTimedBlock:listUpdateBlock. |
136 |
Processor addTimedBlock:listUpdateBlock afterSeconds:listUpdateDelay |
|
85 | 137 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
138 |
|
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
139 |
"Modified: 3.7.1996 / 13:37:29 / stefan" |
1299
d32b7c160ea2
in detail: also care for subInstances of process.
Claus Gittinger <cg@exept.de>
parents:
1165
diff
changeset
|
140 |
"Modified: 21.8.1997 / 15:40:40 / cg" |
85 | 141 |
! |
142 |
||
143 |
updateStatus |
|
144 |
"update status display of processes" |
|
145 |
||
1009 | 146 |
|oldList list line dIndex interrupted contextCount |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
147 |
aProcess nm st n found running sel space oldSelection |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
148 |
newSelection numHeaderLines| |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
149 |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
150 |
numHeaderLines := 2. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
151 |
space := Character space. |
85 | 152 |
|
153 |
shown ifTrue:[ |
|
208 | 154 |
oldList := listView list. |
155 |
processes notNil ifTrue:[ |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
156 |
oldSelection := listView selection. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
157 |
oldSelection notNil ifTrue:[ |
1165
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
158 |
oldSelection := oldSelection collect:[:idx | |pI| |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
159 |
pI := idx-numHeaderLines. |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
160 |
pI > processes size ifTrue:[ |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
161 |
nil |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
162 |
] ifFalse:[ |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
163 |
processes at:pI |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
164 |
] |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
165 |
]. |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
166 |
newSelection := OrderedCollection new. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
167 |
]. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
168 |
|
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
169 |
list := OrderedCollection new:(processes size + numHeaderLines). |
208 | 170 |
list add:self titleLine. |
171 |
list add:(String new:self titleLine size withAll:$-). |
|
85 | 172 |
|
208 | 173 |
interrupted := Processor interruptedProcess. |
85 | 174 |
|
208 | 175 |
dIndex := 1. |
176 |
1 to:processes size do:[:index | |
|
680 | 177 |
|con c totalStack sender id gId| |
85 | 178 |
|
208 | 179 |
aProcess := processes at:index. |
775
f741dc4afe19
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
180 |
(aProcess notNil |
1007 | 181 |
and:[aProcess ~~ 0]) ifTrue:[ |
680 | 182 |
((id := aProcess id) notNil or:[hideDead not]) ifTrue:[ |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
183 |
(oldSelection notNil and:[oldSelection includesIdentical:aProcess]) ifTrue:[ |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
184 |
newSelection add:index+numHeaderLines. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
185 |
]. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
186 |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
187 |
line := WriteStream on:(String new:200). |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
188 |
|
680 | 189 |
id printOn:line paddedTo:5. |
190 |
gId := aProcess processGroupId. |
|
191 |
gId == id ifTrue:[ |
|
192 |
"/ a group leader |
|
193 |
'- ' printOn:line. |
|
194 |
] ifFalse:[ |
|
195 |
gId printOn:line paddedTo:5. |
|
196 |
]. |
|
663
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
197 |
|
208 | 198 |
(nm := aProcess name) isNil ifFalse:[ |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
199 |
nm := nm printStringPaddedTo:28. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
200 |
nm size >= 29 ifTrue:[ |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
201 |
nm := (nm contractTo:28). |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
202 |
]. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
203 |
line nextPutAll:nm; nextPut:space. |
208 | 204 |
] ifTrue:[ |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
205 |
line next:29 put:space. |
208 | 206 |
]. |
680 | 207 |
"/ n := cpuUsages at:(id) ifAbsent:[0]. |
85 | 208 |
"/ n ~~ 0 ifTrue:[ |
209 |
"/ line := line , ((n * 4) printStringLeftPaddedTo:3) |
|
210 |
"/ ] ifFalse:[ |
|
211 |
"/ line := line , ' ' |
|
212 |
"/ ]. |
|
208 | 213 |
st := aProcess state. |
214 |
(st == #run |
|
215 |
and:[aProcess == interrupted]) ifTrue:[ |
|
216 |
c := ' *'. |
|
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
217 |
running := true. |
208 | 218 |
] ifFalse:[ |
219 |
c := ' '. |
|
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
220 |
running := false. |
208 | 221 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
222 |
line nextPutAll:c; nextPutAll:(st printStringPaddedTo:9). |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
223 |
line nextPutAll:(aProcess priority printStringLeftPaddedTo:3). |
143 | 224 |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
225 |
con := aProcess suspendedContext. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
226 |
con isNil ifTrue:[ |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
227 |
aProcess == Processor activeProcess ifTrue:[ |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
228 |
con := thisContext |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
229 |
] |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
230 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
231 |
|
208 | 232 |
showDetail ifTrue:[ |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
233 |
line nextPutAll:(aProcess usedStackSize printStringLeftPaddedTo:11). |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
234 |
|
680 | 235 |
id == 0 ifTrue:[ |
1007 | 236 |
line nextPutAll:('unlimited' leftPaddedTo:14). |
208 | 237 |
] ifFalse:[ |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
238 |
n := aProcess numberOfStackSegments. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
239 |
line nextPutAll:(aProcess totalStackSize printStringLeftPaddedTo:10). |
1007 | 240 |
line nextPutAll:(('(' , n printString , ')') paddedTo:4). |
208 | 241 |
]. |
242 |
con notNil ifTrue:[ |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
243 |
line nextPutAll:' '. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
244 |
line nextPutAll:(((ObjectMemory addressOf:con) printStringRadix:16) leftPaddedTo:8 with:$0). |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
245 |
line nextPutAll:' .. '. |
1009 | 246 |
|
247 |
contextCount := 1. |
|
208 | 248 |
c := con. |
249 |
[(sender := c sender) notNil] whileTrue:[ |
|
1009 | 250 |
c := sender. |
251 |
contextCount := contextCount + 1. |
|
208 | 252 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
253 |
line nextPutAll:(((ObjectMemory addressOf:c) printStringRadix:16) leftPaddedTo:8 with:$0). |
208 | 254 |
] ifFalse:[ |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
255 |
line next:20 put:space. |
208 | 256 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
257 |
line nextPut:space. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
258 |
line nextPutAll:(aProcess numberOfStackBoundaryHits printStringLeftPaddedTo:6). |
208 | 259 |
]. |
143 | 260 |
|
208 | 261 |
con notNil ifTrue:[ |
262 |
c := con. |
|
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
263 |
found := false. |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
264 |
running ifFalse:[ |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
265 |
"/ search for a semaphore-wait in the top 10 contexts |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
266 |
|
208 | 267 |
1 to:10 do:[:n | |
268 |
found ifFalse:[ |
|
269 |
c notNil ifTrue:[ |
|
409
86125c414826
dont send #isMemberOf: to the receiver (could be nil-subclass)
Claus Gittinger <cg@exept.de>
parents:
322
diff
changeset
|
270 |
(c receiver class == Semaphore) ifTrue:[ |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
271 |
c selector == #wait ifTrue:[ |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
272 |
found := true. |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
273 |
] |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
274 |
]. |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
275 |
c := c sender. |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
276 |
] |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
277 |
] |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
278 |
]. |
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
279 |
]. |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
280 |
found ifFalse:[ |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
281 |
"/ search for a non-processor receiver in the top 10 contexts |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
282 |
|
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
283 |
c := con. |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
284 |
1 to:10 do:[:n | |
428
1c7406f57591
skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
285 |
|r| |
1c7406f57591
skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
286 |
|
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
287 |
found ifFalse:[ |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
288 |
c notNil ifTrue:[ |
428
1c7406f57591
skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
289 |
((r := c receiver) ~~ Processor |
1c7406f57591
skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
290 |
and:[r class ~~ Process]) ifTrue:[ |
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
291 |
found := true. |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
292 |
] ifFalse:[ |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
293 |
c := c sender. |
208 | 294 |
] |
295 |
] |
|
296 |
] |
|
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
297 |
] |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
298 |
]. |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
299 |
found ifFalse:[ |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
300 |
c := con |
208 | 301 |
]. |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
302 |
|
208 | 303 |
[c notNil and:[c isBlockContext]] whileTrue:[ |
304 |
c := c home |
|
305 |
]. |
|
306 |
c notNil ifTrue:[ |
|
517 | 307 |
sel := c selector. |
308 |
sel isNil ifTrue:[ |
|
309 |
sel := '* unknown *' |
|
310 |
]. |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
311 |
line nextPutAll:' '. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
312 |
line nextPutAll:c receiver class name. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
313 |
line nextPutAll:'>>'; nextPutAll:sel. |
208 | 314 |
] |
315 |
]. |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
316 |
list add:line contents. |
208 | 317 |
processes at:dIndex put:aProcess. |
318 |
dIndex := dIndex + 1 |
|
319 |
] |
|
320 |
]. |
|
321 |
]. |
|
322 |
dIndex to:processes size do:[:index | |
|
323 |
processes at:index put:nil |
|
324 |
] |
|
325 |
]. |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
326 |
|
208 | 327 |
"avoid flicker" |
328 |
(oldList notNil and:[oldList size == list size]) ifTrue:[ |
|
329 |
list keysAndValuesDo:[:idx :entry | |
|
330 |
(oldList at:idx) ~= entry ifTrue:[ |
|
331 |
listView at:idx put:entry |
|
332 |
] |
|
333 |
] |
|
334 |
] ifFalse:[ |
|
335 |
listView setList:list. |
|
336 |
"the first two entries cannot be selected" |
|
337 |
listView attributeAt:1 put:#disabled. |
|
338 |
listView attributeAt:2 put:#disabled. |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
339 |
|
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
340 |
oldSelection notNil ifTrue:[ |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
341 |
listView selection:newSelection. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
342 |
] |
314
728eab568865
Flush output when updating display.
Stefan Vogel <sv@exept.de>
parents:
208
diff
changeset
|
343 |
]. |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
344 |
"/ listView flush |
85 | 345 |
]. |
346 |
updateBlock notNil ifTrue:[ |
|
208 | 347 |
Processor removeTimedBlock:updateBlock. |
348 |
Processor addTimedBlock:updateBlock afterSeconds:updateDelay |
|
85 | 349 |
] |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
350 |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
351 |
"Modified: 3.7.1996 / 13:56:01 / stefan" |
1165
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
352 |
"Modified: 24.4.1997 / 21:16:25 / cg" |
143 | 353 |
! ! |
354 |
||
19 | 355 |
!ProcessMonitor methodsFor:'initialization'! |
356 |
||
357 |
initialize |
|
358 |
super initialize. |
|
359 |
||
45 | 360 |
hideDead := true. |
109 | 361 |
showDetail := Smalltalk at:#SystemDebugging ifAbsent:false. |
45 | 362 |
|
19 | 363 |
device hasColors ifTrue:[ |
315
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
364 |
runColor := Color green. |
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
365 |
suspendedColor := Color yellow. |
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
366 |
waitColor := Color red. |
19 | 367 |
] ifFalse:[ |
315
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
368 |
runColor := suspendedColor := waitColor := Color black |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
369 |
]. |
19 | 370 |
|
45 | 371 |
" |
372 |
ProcessMonitor open |
|
373 |
" |
|
315
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
374 |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
375 |
"Modified: 23.1.1997 / 02:51:38 / cg" |
85 | 376 |
! |
377 |
||
208 | 378 |
realize |
379 |
waitColor := waitColor on:device. |
|
380 |
runColor := runColor on:device. |
|
381 |
suspendedColor := suspendedColor on:device. |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
382 |
super realize. |
56 | 383 |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
384 |
"Modified: 23.1.1997 / 02:30:37 / cg" |
19 | 385 |
! ! |
386 |
||
387 |
!ProcessMonitor methodsFor:'menu actions'! |
|
388 |
||
208 | 389 |
abortProcess |
390 |
"abort (raise AbortSignal in) the selected process" |
|
391 |
||
392 |
self selectedProcessesDo:[:p | |
|
393 |
p interruptWith:[AbortSignal raise] |
|
394 |
] |
|
395 |
! |
|
396 |
||
397 |
debugProcess |
|
398 |
"open a debugger on the selected process" |
|
399 |
||
400 |
self selectedProcessesDo:[:p | |
|
401 |
Debugger openOn:p |
|
402 |
] |
|
403 |
! |
|
404 |
||
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
405 |
hideDead:aBoolean |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
406 |
"turn on/off hiding of dead (already terminated) processes" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
407 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
408 |
hideDead := aBoolean |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
409 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
410 |
"Modified: 23.1.1997 / 02:34:01 / cg" |
208 | 411 |
! |
412 |
||
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
413 |
inspectSelection |
208 | 414 |
"open an inspector on the selected process" |
415 |
||
416 |
self selectedProcessesSend:#inspect |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
417 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
418 |
"Created: 23.1.1997 / 02:27:33 / cg" |
208 | 419 |
! |
420 |
||
421 |
lowerPrio |
|
422 |
"lower the selected processes priority" |
|
423 |
||
424 |
self selectedProcessesDo:[:p | |
|
425 |
p priority:(p priority - 1) |
|
426 |
] |
|
427 |
! |
|
428 |
||
429 |
raisePrio |
|
430 |
"raise the selected processes priority" |
|
143 | 431 |
|
432 |
self selectedProcessesDo:[:p | |
|
208 | 433 |
p priority:(p priority + 1) |
143 | 434 |
] |
435 |
! |
|
436 |
||
817 | 437 |
restartProcess |
438 |
"abort (raise AbortSignal in) the selected process" |
|
439 |
||
440 |
self selectedProcessesDo:[:p | |
|
441 |
p restart. |
|
442 |
] |
|
443 |
! |
|
444 |
||
143 | 445 |
resumeProcess |
446 |
"resume the selected process (i.e. let it run) " |
|
447 |
||
448 |
self selectedProcessesSend:#resume |
|
449 |
! |
|
450 |
||
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
451 |
statusMenu |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
452 |
"return a popUpMenu" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
453 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
454 |
|labels selectors m sel allRestartable| |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
455 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
456 |
device ctrlDown ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
457 |
labels := resources array:#( |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
458 |
'\c detail' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
459 |
). |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
460 |
selectors := #( |
1003 | 461 |
toggleDetail |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
462 |
). |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
463 |
] ifFalse:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
464 |
labels := resources array:#( |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
465 |
'inspect' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
466 |
'debug' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
467 |
'-' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
468 |
'resume' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
469 |
'suspend' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
470 |
'stop' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
471 |
'abort' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
472 |
'terminate' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
473 |
'terminate group' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
474 |
'restart' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
475 |
'-' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
476 |
'raise prio' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
477 |
'lower prio' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
478 |
). |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
479 |
selectors := #( |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
480 |
inspectSelection |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
481 |
debugProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
482 |
nil |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
483 |
resumeProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
484 |
suspendProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
485 |
stopProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
486 |
abortProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
487 |
terminateProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
488 |
terminateProcessGroup |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
489 |
restartProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
490 |
nil |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
491 |
raisePrio |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
492 |
lowerPrio |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
493 |
). |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
494 |
updateProcess isNil ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
495 |
labels := (resources array:#('update' '-')) , labels. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
496 |
selectors := #(updateView nil) , selectors |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
497 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
498 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
499 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
500 |
m := PopUpMenu labels:labels |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
501 |
selectors:selectors. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
502 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
503 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
504 |
listView hasSelection ifFalse:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
505 |
m disableAll:#( |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
506 |
inspectSelection |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
507 |
debugProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
508 |
resumeProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
509 |
suspendProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
510 |
stopProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
511 |
restartProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
512 |
abortProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
513 |
terminateProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
514 |
terminateProcessGroup |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
515 |
raisePrio |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
516 |
lowerPrio |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
517 |
) |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
518 |
] ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
519 |
allRestartable := true. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
520 |
self selectedProcessesDo:[:p | |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
521 |
p isRestartable ifFalse:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
522 |
allRestartable := false |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
523 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
524 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
525 |
allRestartable ifFalse:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
526 |
m disable:#restartProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
527 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
528 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
529 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
530 |
m checkToggleAt:#toggleDetail put:showDetail. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
531 |
^ m |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
532 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
533 |
"Created: 23.1.1997 / 03:05:54 / cg" |
1003 | 534 |
"Modified: 27.1.1997 / 20:41:03 / cg" |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
535 |
! |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
536 |
|
92 | 537 |
stopProcess |
538 |
"stop the selected process - not even interrupts will wake it up" |
|
539 |
||
540 |
self selectedProcessesSend:#stop |
|
541 |
! |
|
542 |
||
19 | 543 |
suspendProcess |
92 | 544 |
"suspend the selected process - interrupts will let it run again" |
545 |
||
58 | 546 |
self selectedProcessesSend:#suspend |
85 | 547 |
! |
45 | 548 |
|
208 | 549 |
terminateProcess |
550 |
"terminate the selected process" |
|
92 | 551 |
|
208 | 552 |
self selectedProcessesSend:#terminate |
663
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
553 |
! |
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
554 |
|
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
555 |
terminateProcessGroup |
817 | 556 |
"terminate the selected process with all of its subprocesses" |
663
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
557 |
|
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
558 |
self selectedProcessesSend:#terminateGroup |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
559 |
! |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
560 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
561 |
toggleDetail |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
562 |
"toggle detail" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
563 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
564 |
showDetail := showDetail not. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
565 |
self updateView |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
566 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
567 |
"Modified: 23.1.1997 / 02:33:03 / cg" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
568 |
"Created: 23.1.1997 / 02:33:30 / cg" |
19 | 569 |
! ! |
570 |
||
143 | 571 |
!ProcessMonitor methodsFor:'private'! |
572 |
||
573 |
selectedProcessesDo:aBlock |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
574 |
"evaluate aBlock on all selected processes" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
575 |
|
143 | 576 |
|p nr sel| |
85 | 577 |
|
143 | 578 |
sel := listView selection. |
579 |
sel isNil ifTrue:[^ self]. |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
580 |
|
143 | 581 |
(sel isKindOf:Collection) ifTrue:[ |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
582 |
sel do:[:n | |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
583 |
nr := n - 2. "for headlines" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
584 |
nr notNil ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
585 |
nr > 0 ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
586 |
p := processes at:nr. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
587 |
(p notNil and:[p ~~ 0]) ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
588 |
aBlock value:p |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
589 |
] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
590 |
] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
591 |
] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
592 |
] |
85 | 593 |
] ifFalse:[ |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
594 |
nr := sel - 2. "for headlines" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
595 |
nr notNil ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
596 |
nr > 0 ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
597 |
p := processes at:nr. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
598 |
(p notNil and:[p ~~ 0]) ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
599 |
aBlock value:p |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
600 |
] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
601 |
] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
602 |
] |
85 | 603 |
]. |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
604 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
605 |
"Modified: 23.1.1997 / 03:10:53 / cg" |
143 | 606 |
! |
607 |
||
608 |
selectedProcessesSend:aSelector |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
609 |
"send a message to all selected processes" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
610 |
|
143 | 611 |
self selectedProcessesDo:[:p | |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
612 |
p perform:aSelector |
143 | 613 |
]. |
614 |
self updateView. |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
615 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
616 |
"Modified: 23.1.1997 / 02:34:49 / cg" |
85 | 617 |
! ! |
618 |
||
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
619 |
!ProcessMonitor methodsFor:'user actions'! |
85 | 620 |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
621 |
doubleClicked |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
622 |
"open a debugger on the selected process" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
623 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
624 |
self debugProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
625 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
626 |
"Created: 23.1.1997 / 03:21:30 / cg" |
85 | 627 |
! ! |
208 | 628 |
|
771
5cd10b4845f3
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
629 |
!ProcessMonitor class methodsFor:'documentation'! |
208 | 630 |
|
631 |
version |
|
1299
d32b7c160ea2
in detail: also care for subInstances of process.
Claus Gittinger <cg@exept.de>
parents:
1165
diff
changeset
|
632 |
^ '$Header: /cvs/stx/stx/libtool/ProcessMonitor.st,v 1.54 1997-08-21 13:41:19 cg Exp $' |
1053 | 633 |
! ! |