author | Claus Gittinger <cg@exept.de> |
Wed, 04 Mar 1998 19:16:15 +0100 | |
changeset 1505 | 417ccb5b70b7 |
parent 1504 | ca559ae2710a |
child 1620 | 51341ec8360b |
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' |
|
1300 | 91 |
! |
92 |
||
93 |
nameLengthInList |
|
94 |
^ 30 |
|
95 |
||
96 |
"Created: 21.8.1997 / 15:42:05 / cg" |
|
85 | 97 |
! ! |
98 |
||
99 |
!ProcessMonitor methodsFor:'drawing'! |
|
100 |
||
101 |
titleLine |
|
109 | 102 |
showDetail ifTrue:[ |
1504 | 103 |
^ 'id group name state prio usedStack totalStack current-segment switch where'. |
109 | 104 |
]. |
1504 | 105 |
^ 'id group name state prio where '. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
106 |
|
1504 | 107 |
"Modified: / 3.7.1996 / 13:57:38 / stefan" |
108 |
"Modified: / 4.3.1998 / 17:14:06 / cg" |
|
85 | 109 |
! |
110 |
||
111 |
updateList |
|
112 |
"update list of processes" |
|
113 |
||
114 |
|newList| |
|
115 |
||
116 |
shown ifTrue:[ |
|
208 | 117 |
showDetail ifTrue:[ |
1299
d32b7c160ea2
in detail: also care for subInstances of process.
Claus Gittinger <cg@exept.de>
parents:
1165
diff
changeset
|
118 |
newList := Process allSubInstances asOrderedCollection. |
208 | 119 |
] ifFalse:[ |
120 |
newList := ProcessorScheduler knownProcesses asOrderedCollection. |
|
121 |
]. |
|
85 | 122 |
|
208 | 123 |
"sort by id - take care of nil ids of dead processes" |
124 |
newList sort:[:p1 :p2 | |
|
125 |
|id1 id2| |
|
85 | 126 |
|
208 | 127 |
(p1 isNil or:[(id1 := p1 id) isNil]) |
128 |
ifTrue:[true] |
|
129 |
ifFalse:[ |
|
130 |
(p2 isNil or:[(id2 := p2 id) isNil]) |
|
131 |
ifTrue:[false] |
|
132 |
ifFalse:[id1 < id2] |
|
133 |
] |
|
134 |
]. |
|
135 |
newList ~= processes ifTrue:[ |
|
136 |
processes := WeakArray withAll:newList. |
|
137 |
self updateStatus |
|
138 |
]. |
|
85 | 139 |
]. |
140 |
updateBlock notNil ifTrue:[ |
|
208 | 141 |
Processor removeTimedBlock:listUpdateBlock. |
142 |
Processor addTimedBlock:listUpdateBlock afterSeconds:listUpdateDelay |
|
85 | 143 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
144 |
|
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
145 |
"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
|
146 |
"Modified: 21.8.1997 / 15:40:40 / cg" |
85 | 147 |
! |
148 |
||
149 |
updateStatus |
|
150 |
"update status display of processes" |
|
151 |
||
1009 | 152 |
|oldList list line dIndex interrupted contextCount |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
153 |
aProcess nm st n found running sel space oldSelection |
1301 | 154 |
newSelection numHeaderLines nameLength index |
155 |
con c totalStack sender id gId| |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
156 |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
157 |
numHeaderLines := 2. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
158 |
space := Character space. |
1300 | 159 |
nameLength := self class nameLengthInList. |
85 | 160 |
|
161 |
shown ifTrue:[ |
|
208 | 162 |
oldList := listView list. |
163 |
processes notNil ifTrue:[ |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
164 |
oldSelection := listView selection. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
165 |
oldSelection notNil ifTrue:[ |
1165
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
166 |
oldSelection := oldSelection collect:[:idx | |pI| |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
167 |
pI := idx-numHeaderLines. |
1349 | 168 |
(pI > processes size or:[pI < 1]) ifTrue:[ |
1165
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
169 |
nil |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
170 |
] ifFalse:[ |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
171 |
processes at:pI |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
172 |
] |
c5329c0e03dd
care for selectedProcess dying
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
173 |
]. |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
174 |
newSelection := OrderedCollection new. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
175 |
]. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
176 |
|
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
177 |
list := OrderedCollection new:(processes size + numHeaderLines). |
208 | 178 |
list add:self titleLine. |
179 |
list add:(String new:self titleLine size withAll:$-). |
|
85 | 180 |
|
208 | 181 |
interrupted := Processor interruptedProcess. |
85 | 182 |
|
208 | 183 |
dIndex := 1. |
1301 | 184 |
index := 1. |
185 |
||
186 |
"/ use while-loop; |
|
187 |
"/ processList may change size .... |
|
85 | 188 |
|
1301 | 189 |
[index <= processes size] whileTrue:[ |
208 | 190 |
aProcess := processes at:index. |
1301 | 191 |
index := index + 1. |
192 |
||
775
f741dc4afe19
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
193 |
(aProcess notNil |
1007 | 194 |
and:[aProcess ~~ 0]) ifTrue:[ |
680 | 195 |
((id := aProcess id) notNil or:[hideDead not]) ifTrue:[ |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
196 |
(oldSelection notNil and:[oldSelection includesIdentical:aProcess]) ifTrue:[ |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
197 |
newSelection add:index+numHeaderLines. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
198 |
]. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
199 |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
200 |
line := WriteStream on:(String new:200). |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
201 |
|
1504 | 202 |
id printOn:line paddedTo:6. |
680 | 203 |
gId := aProcess processGroupId. |
204 |
gId == id ifTrue:[ |
|
205 |
"/ a group leader |
|
1505 | 206 |
'- ' printOn:line. |
680 | 207 |
] ifFalse:[ |
1504 | 208 |
gId printOn:line paddedTo:6. |
680 | 209 |
]. |
663
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
210 |
|
208 | 211 |
(nm := aProcess name) isNil ifFalse:[ |
1300 | 212 |
nm := nm printStringPaddedTo:(nameLength-1). |
213 |
nm size >= nameLength ifTrue:[ |
|
214 |
nm := (nm contractTo:(nameLength-1)). |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
215 |
]. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
216 |
line nextPutAll:nm; nextPut:space. |
208 | 217 |
] ifTrue:[ |
1300 | 218 |
line next:(nameLength) put:space. |
208 | 219 |
]. |
680 | 220 |
"/ n := cpuUsages at:(id) ifAbsent:[0]. |
85 | 221 |
"/ n ~~ 0 ifTrue:[ |
222 |
"/ line := line , ((n * 4) printStringLeftPaddedTo:3) |
|
223 |
"/ ] ifFalse:[ |
|
224 |
"/ line := line , ' ' |
|
225 |
"/ ]. |
|
208 | 226 |
st := aProcess state. |
227 |
(st == #run |
|
228 |
and:[aProcess == interrupted]) ifTrue:[ |
|
229 |
c := ' *'. |
|
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
230 |
running := true. |
208 | 231 |
] ifFalse:[ |
232 |
c := ' '. |
|
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
233 |
running := false. |
208 | 234 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
235 |
line nextPutAll:c; nextPutAll:(st printStringPaddedTo:9). |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
236 |
line nextPutAll:(aProcess priority printStringLeftPaddedTo:3). |
143 | 237 |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
238 |
con := aProcess suspendedContext. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
239 |
con isNil ifTrue:[ |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
240 |
aProcess == Processor activeProcess ifTrue:[ |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
241 |
con := thisContext |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
242 |
] |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
243 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
244 |
|
208 | 245 |
showDetail ifTrue:[ |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
246 |
line nextPutAll:(aProcess usedStackSize printStringLeftPaddedTo:11). |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
247 |
|
680 | 248 |
id == 0 ifTrue:[ |
1007 | 249 |
line nextPutAll:('unlimited' leftPaddedTo:14). |
208 | 250 |
] ifFalse:[ |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
251 |
n := aProcess numberOfStackSegments. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
252 |
line nextPutAll:(aProcess totalStackSize printStringLeftPaddedTo:10). |
1007 | 253 |
line nextPutAll:(('(' , n printString , ')') paddedTo:4). |
208 | 254 |
]. |
255 |
con notNil ifTrue:[ |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
256 |
line nextPutAll:' '. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
257 |
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
|
258 |
line nextPutAll:' .. '. |
1009 | 259 |
|
260 |
contextCount := 1. |
|
208 | 261 |
c := con. |
262 |
[(sender := c sender) notNil] whileTrue:[ |
|
1009 | 263 |
c := sender. |
264 |
contextCount := contextCount + 1. |
|
208 | 265 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
266 |
line nextPutAll:(((ObjectMemory addressOf:c) printStringRadix:16) leftPaddedTo:8 with:$0). |
208 | 267 |
] ifFalse:[ |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
268 |
line next:20 put:space. |
208 | 269 |
]. |
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
270 |
line nextPut:space. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
271 |
line nextPutAll:(aProcess numberOfStackBoundaryHits printStringLeftPaddedTo:6). |
208 | 272 |
]. |
143 | 273 |
|
208 | 274 |
con notNil ifTrue:[ |
275 |
c := con. |
|
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
276 |
found := false. |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
277 |
running ifFalse:[ |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
278 |
"/ 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
|
279 |
|
208 | 280 |
1 to:10 do:[:n | |
281 |
found ifFalse:[ |
|
282 |
c notNil ifTrue:[ |
|
409
86125c414826
dont send #isMemberOf: to the receiver (could be nil-subclass)
Claus Gittinger <cg@exept.de>
parents:
322
diff
changeset
|
283 |
(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
|
284 |
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
|
285 |
found := true. |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
286 |
] |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
287 |
]. |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
288 |
c := c sender. |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
289 |
] |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
290 |
] |
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
291 |
]. |
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
292 |
]. |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
293 |
found ifFalse:[ |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
294 |
"/ 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
|
295 |
|
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
296 |
c := con. |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
297 |
1 to:10 do:[:n | |
428
1c7406f57591
skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
298 |
|r| |
1c7406f57591
skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
299 |
|
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
300 |
found ifFalse:[ |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
301 |
c notNil ifTrue:[ |
428
1c7406f57591
skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
302 |
((r := c receiver) ~~ Processor |
1c7406f57591
skip Process contexts in display
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
303 |
and:[r class ~~ Process]) ifTrue:[ |
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
304 |
found := true. |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
305 |
] ifFalse:[ |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
306 |
c := c sender. |
208 | 307 |
] |
308 |
] |
|
309 |
] |
|
413
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
310 |
] |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
311 |
]. |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
312 |
found ifFalse:[ |
715a6a18f825
better display of running processes context
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
313 |
c := con |
208 | 314 |
]. |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
315 |
|
208 | 316 |
[c notNil and:[c isBlockContext]] whileTrue:[ |
317 |
c := c home |
|
318 |
]. |
|
319 |
c notNil ifTrue:[ |
|
517 | 320 |
sel := c selector. |
321 |
sel isNil ifTrue:[ |
|
322 |
sel := '* unknown *' |
|
323 |
]. |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
324 |
line nextPutAll:' '. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
325 |
line nextPutAll:c receiver class name. |
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
326 |
line nextPutAll:'>>'; nextPutAll:sel. |
208 | 327 |
] |
328 |
]. |
|
656
3a625e4aa73f
Use a Stream to construct lines.
Stefan Vogel <sv@exept.de>
parents:
619
diff
changeset
|
329 |
list add:line contents. |
208 | 330 |
processes at:dIndex put:aProcess. |
331 |
dIndex := dIndex + 1 |
|
332 |
] |
|
333 |
]. |
|
334 |
]. |
|
335 |
dIndex to:processes size do:[:index | |
|
336 |
processes at:index put:nil |
|
337 |
] |
|
338 |
]. |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
339 |
|
208 | 340 |
"avoid flicker" |
341 |
(oldList notNil and:[oldList size == list size]) ifTrue:[ |
|
342 |
list keysAndValuesDo:[:idx :entry | |
|
343 |
(oldList at:idx) ~= entry ifTrue:[ |
|
344 |
listView at:idx put:entry |
|
345 |
] |
|
346 |
] |
|
347 |
] ifFalse:[ |
|
348 |
listView setList:list. |
|
349 |
"the first two entries cannot be selected" |
|
350 |
listView attributeAt:1 put:#disabled. |
|
351 |
listView attributeAt:2 put:#disabled. |
|
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
352 |
|
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
353 |
oldSelection notNil ifTrue:[ |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
354 |
listView selection:newSelection. |
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
355 |
] |
314
728eab568865
Flush output when updating display.
Stefan Vogel <sv@exept.de>
parents:
208
diff
changeset
|
356 |
]. |
1103
c70ece0e331a
keep selection when list changes
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
357 |
"/ listView flush |
85 | 358 |
]. |
359 |
updateBlock notNil ifTrue:[ |
|
208 | 360 |
Processor removeTimedBlock:updateBlock. |
361 |
Processor addTimedBlock:updateBlock afterSeconds:updateDelay |
|
85 | 362 |
] |
322
e3ccd5e431df
fixed context display (dont search for suspending context in running processes)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
363 |
|
1504 | 364 |
"Modified: / 3.7.1996 / 13:56:01 / stefan" |
1505 | 365 |
"Modified: / 4.3.1998 / 18:15:38 / cg" |
143 | 366 |
! ! |
367 |
||
19 | 368 |
!ProcessMonitor methodsFor:'initialization'! |
369 |
||
370 |
initialize |
|
371 |
super initialize. |
|
372 |
||
45 | 373 |
hideDead := true. |
109 | 374 |
showDetail := Smalltalk at:#SystemDebugging ifAbsent:false. |
45 | 375 |
|
19 | 376 |
device hasColors ifTrue:[ |
315
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
377 |
runColor := Color green. |
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
378 |
suspendedColor := Color yellow. |
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
379 |
waitColor := Color red. |
19 | 380 |
] ifFalse:[ |
315
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
381 |
runColor := suspendedColor := waitColor := Color black |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
382 |
]. |
19 | 383 |
|
45 | 384 |
" |
385 |
ProcessMonitor open |
|
386 |
" |
|
315
8a86faf847d1
create a new updateProcess when restarted
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
387 |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
388 |
"Modified: 23.1.1997 / 02:51:38 / cg" |
85 | 389 |
! |
390 |
||
208 | 391 |
realize |
392 |
waitColor := waitColor on:device. |
|
393 |
runColor := runColor on:device. |
|
394 |
suspendedColor := suspendedColor on:device. |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
395 |
super realize. |
56 | 396 |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
397 |
"Modified: 23.1.1997 / 02:30:37 / cg" |
19 | 398 |
! ! |
399 |
||
400 |
!ProcessMonitor methodsFor:'menu actions'! |
|
401 |
||
208 | 402 |
abortProcess |
403 |
"abort (raise AbortSignal in) the selected process" |
|
404 |
||
405 |
self selectedProcessesDo:[:p | |
|
406 |
p interruptWith:[AbortSignal raise] |
|
407 |
] |
|
408 |
! |
|
409 |
||
410 |
debugProcess |
|
411 |
"open a debugger on the selected process" |
|
412 |
||
413 |
self selectedProcessesDo:[:p | |
|
414 |
Debugger openOn:p |
|
415 |
] |
|
416 |
! |
|
417 |
||
1301 | 418 |
hardTerminateProcess |
419 |
"hard terminate the selected process" |
|
420 |
||
421 |
self selectedProcessesSend:#terminateNoSignal |
|
422 |
||
423 |
"Created: 22.8.1997 / 02:06:51 / cg" |
|
424 |
! |
|
425 |
||
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
426 |
hideDead:aBoolean |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
427 |
"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
|
428 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
429 |
hideDead := aBoolean |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
430 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
431 |
"Modified: 23.1.1997 / 02:34:01 / cg" |
208 | 432 |
! |
433 |
||
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
434 |
inspectSelection |
208 | 435 |
"open an inspector on the selected process" |
436 |
||
437 |
self selectedProcessesSend:#inspect |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
438 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
439 |
"Created: 23.1.1997 / 02:27:33 / cg" |
208 | 440 |
! |
441 |
||
442 |
lowerPrio |
|
443 |
"lower the selected processes priority" |
|
444 |
||
445 |
self selectedProcessesDo:[:p | |
|
446 |
p priority:(p priority - 1) |
|
447 |
] |
|
448 |
! |
|
449 |
||
450 |
raisePrio |
|
451 |
"raise the selected processes priority" |
|
143 | 452 |
|
453 |
self selectedProcessesDo:[:p | |
|
208 | 454 |
p priority:(p priority + 1) |
143 | 455 |
] |
456 |
! |
|
457 |
||
817 | 458 |
restartProcess |
459 |
"abort (raise AbortSignal in) the selected process" |
|
460 |
||
461 |
self selectedProcessesDo:[:p | |
|
462 |
p restart. |
|
463 |
] |
|
464 |
! |
|
465 |
||
143 | 466 |
resumeProcess |
467 |
"resume the selected process (i.e. let it run) " |
|
468 |
||
469 |
self selectedProcessesSend:#resume |
|
470 |
! |
|
471 |
||
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
472 |
statusMenu |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
473 |
"return a popUpMenu" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
474 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
475 |
|labels selectors m sel allRestartable| |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
476 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
477 |
device ctrlDown ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
478 |
labels := resources array:#( |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
479 |
'\c detail' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
480 |
). |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
481 |
selectors := #( |
1003 | 482 |
toggleDetail |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
483 |
). |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
484 |
] ifFalse:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
485 |
labels := resources array:#( |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
486 |
'inspect' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
487 |
'debug' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
488 |
'-' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
489 |
'resume' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
490 |
'suspend' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
491 |
'stop' |
1301 | 492 |
'-' |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
493 |
'abort' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
494 |
'terminate' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
495 |
'terminate group' |
1301 | 496 |
"/ 'hard terminate' |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
497 |
'restart' |
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 |
'raise prio' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
500 |
'lower prio' |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
501 |
). |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
502 |
selectors := #( |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
503 |
inspectSelection |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
504 |
debugProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
505 |
nil |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
506 |
resumeProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
507 |
suspendProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
508 |
stopProcess |
1301 | 509 |
nil |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
510 |
abortProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
511 |
terminateProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
512 |
terminateProcessGroup |
1301 | 513 |
"/ hardTerminateProcess |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
514 |
restartProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
515 |
nil |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
516 |
raisePrio |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
517 |
lowerPrio |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
518 |
). |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
519 |
updateProcess isNil ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
520 |
labels := (resources array:#('update' '-')) , labels. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
521 |
selectors := #(updateView nil) , selectors |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
522 |
]. |
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 |
m := PopUpMenu labels:labels |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
526 |
selectors:selectors. |
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 |
listView hasSelection ifFalse:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
530 |
m disableAll:#( |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
531 |
inspectSelection |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
532 |
debugProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
533 |
resumeProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
534 |
suspendProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
535 |
stopProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
536 |
restartProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
537 |
abortProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
538 |
terminateProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
539 |
terminateProcessGroup |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
540 |
raisePrio |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
541 |
lowerPrio |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
542 |
) |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
543 |
] ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
544 |
allRestartable := true. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
545 |
self selectedProcessesDo:[:p | |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
546 |
p isRestartable ifFalse:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
547 |
allRestartable := false |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
548 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
549 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
550 |
allRestartable ifFalse:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
551 |
m disable:#restartProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
552 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
553 |
]. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
554 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
555 |
m checkToggleAt:#toggleDetail put:showDetail. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
556 |
^ m |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
557 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
558 |
"Created: 23.1.1997 / 03:05:54 / cg" |
1301 | 559 |
"Modified: 22.8.1997 / 17:54:26 / cg" |
979
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 |
|
92 | 562 |
stopProcess |
563 |
"stop the selected process - not even interrupts will wake it up" |
|
564 |
||
565 |
self selectedProcessesSend:#stop |
|
566 |
! |
|
567 |
||
19 | 568 |
suspendProcess |
92 | 569 |
"suspend the selected process - interrupts will let it run again" |
570 |
||
58 | 571 |
self selectedProcessesSend:#suspend |
85 | 572 |
! |
45 | 573 |
|
208 | 574 |
terminateProcess |
575 |
"terminate the selected process" |
|
92 | 576 |
|
208 | 577 |
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
|
578 |
! |
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
579 |
|
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
580 |
terminateProcessGroup |
817 | 581 |
"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
|
582 |
|
befe6a1d886f
show process group & added menu item to terminate a complete group
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
583 |
self selectedProcessesSend:#terminateGroup |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
584 |
! |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
585 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
586 |
toggleDetail |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
587 |
"toggle detail" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
588 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
589 |
showDetail := showDetail not. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
590 |
self updateView |
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 |
"Modified: 23.1.1997 / 02:33:03 / cg" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
593 |
"Created: 23.1.1997 / 02:33:30 / cg" |
19 | 594 |
! ! |
595 |
||
143 | 596 |
!ProcessMonitor methodsFor:'private'! |
597 |
||
598 |
selectedProcessesDo:aBlock |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
599 |
"evaluate aBlock on all selected processes" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
600 |
|
143 | 601 |
|p nr sel| |
85 | 602 |
|
143 | 603 |
sel := listView selection. |
604 |
sel isNil ifTrue:[^ self]. |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
605 |
|
143 | 606 |
(sel isKindOf:Collection) ifTrue:[ |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
607 |
sel do:[:n | |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
608 |
nr := n - 2. "for headlines" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
609 |
nr notNil ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
610 |
nr > 0 ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
611 |
p := processes at:nr. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
612 |
(p notNil and:[p ~~ 0]) ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
613 |
aBlock value:p |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
614 |
] |
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 |
] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
617 |
] |
85 | 618 |
] ifFalse:[ |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
619 |
nr := sel - 2. "for headlines" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
620 |
nr notNil ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
621 |
nr > 0 ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
622 |
p := processes at:nr. |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
623 |
(p notNil and:[p ~~ 0]) ifTrue:[ |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
624 |
aBlock value:p |
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 |
] |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
627 |
] |
85 | 628 |
]. |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
629 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
630 |
"Modified: 23.1.1997 / 03:10:53 / cg" |
143 | 631 |
! |
632 |
||
633 |
selectedProcessesSend:aSelector |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
634 |
"send a message to all selected processes" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
635 |
|
143 | 636 |
self selectedProcessesDo:[:p | |
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
637 |
p perform:aSelector |
143 | 638 |
]. |
639 |
self updateView. |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
640 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
641 |
"Modified: 23.1.1997 / 02:34:49 / cg" |
85 | 642 |
! ! |
643 |
||
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
644 |
!ProcessMonitor methodsFor:'user actions'! |
85 | 645 |
|
979
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
646 |
doubleClicked |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
647 |
"open a debugger on the selected process" |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
648 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
649 |
self debugProcess |
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
650 |
|
c1e318bee326
extracted common stuff into a superclass
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
651 |
"Created: 23.1.1997 / 03:21:30 / cg" |
85 | 652 |
! ! |
208 | 653 |
|
771
5cd10b4845f3
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
682
diff
changeset
|
654 |
!ProcessMonitor class methodsFor:'documentation'! |
208 | 655 |
|
656 |
version |
|
1505 | 657 |
^ '$Header: /cvs/stx/stx/libtool/Attic/ProcMonitor.st,v 1.59 1998-03-04 18:16:15 cg Exp $' |
1053 | 658 |
! ! |