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