author | Jan Vrany <jan.vrany@labware.com> |
Wed, 08 Mar 2023 16:40:41 +0000 | |
branch | jv |
changeset 19643 | b3148ab32c03 |
parent 17136 | cb908d2ba02e |
permissions | -rw-r--r-- |
2363 | 1 |
" |
2 |
COPYRIGHT (c) 1991 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 |
" |
|
3173 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
16091 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
2363 | 16 |
View subclass:#MemoryMonitorView |
17 |
instanceVariableNames:'updateInterval updateBlock myProcess oldData newData freeData |
|
18 |
updateIndex org maxTotal minTotal dX newColor freeColor oldColor |
|
12408 | 19 |
prevTotal prevLimit prevFree prevFree2 prevOld scale drawLock |
20 |
prevMemUsed prevCodeUsed prevNumWeak prevNumRem prevNumLifoRem |
|
21 |
prevTenureAge prevIGCPhase prevLastScavengeReclamation |
|
17013 | 22 |
prevMinScavengeReclamation prevScavengeCount mallocColor |
23 |
drawAction' |
|
2363 | 24 |
classVariableNames:'' |
25 |
poolDictionaries:'' |
|
26 |
category:'Monitors-ST/X' |
|
27 |
! |
|
28 |
||
29 |
!MemoryMonitorView class methodsFor:'documentation'! |
|
30 |
||
31 |
copyright |
|
32 |
" |
|
33 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
34 |
All Rights Reserved |
|
35 |
||
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
44 |
||
45 |
documentation |
|
46 |
" |
|
47 |
Shows memory usage (oldspace + newspace). Simple, but useful. |
|
48 |
||
49 |
The numbers shown are: |
|
50 |
tot total memory usage (i.e. allocated oldSpace + allocated newSpace) |
|
51 |
(does not include the second semispace and other help-areas, |
|
52 |
such as the remembered set etc.) |
|
53 |
||
54 |
all current oldSpace in use + newSpace in use |
|
55 |
||
56 |
new current newSpace in use |
|
57 |
||
58 |
frl free space in (fragmented) free lists |
|
59 |
fre compact free area above the used oldSpace |
|
60 |
||
61 |
old current oldSpace in use |
|
62 |
||
10574 | 63 |
mal memory used by malloc (netto) |
64 |
||
65 |
mto total memory that has been reserved by the malloc subsystem |
|
66 |
(may contained mem that has been freed or not yet allocated) |
|
67 |
||
2363 | 68 |
cod dynamic compiled code space size (just in time compiler) |
69 |
||
70 |
max, extreme values of 'tot' since the monitor started |
|
71 |
min (can be reset by typing 'r' in the view) |
|
72 |
||
73 |
t tenure threshold (1 .. 30) |
|
74 |
||
75 |
I incremental GC state (2 = idle) |
|
76 |
||
77 |
weak number of weak objects |
|
78 |
||
79 |
rem size of rememberedSet |
|
80 |
||
81 |
minsc: percent of newspace remaining after scavenge (worst case) |
|
82 |
(i.e. the minimum %% of scavenged objects) |
|
83 |
||
84 |
count number of scavenges since system started |
|
85 |
||
86 |
% percentage of live objects in newSpace after last scavenge |
|
87 |
(i.e. this is the garbage vs. living objects ratio of |
|
88 |
newSpace objects after the last scavenge) |
|
89 |
||
90 |
the graphic shows: |
|
91 |
orange newSpace used |
|
92 |
green free memory in freeLists |
|
93 |
white oldSpace used |
|
94 |
||
95 |
||
96 |
the popupMenu offers GC functions; keyboard options are: |
|
97 |
'f' -> faster; 's' -> slower; 'r' -> reset min/max |
|
98 |
||
17013 | 99 |
Disclaimer: |
100 |
this was one of the first tools written for ST/X (around 1989/90); |
|
101 |
today, it would probably be written differently... |
|
102 |
||
2363 | 103 |
[author:] |
104 |
Claus Gittinger |
|
105 |
||
106 |
[start with:] |
|
2367 | 107 |
MemoryMonitor open |
2363 | 108 |
MemoryMonitorView open |
109 |
||
110 |
[see also:] |
|
2367 | 111 |
ObjectMemory MemoryMonitor |
2363 | 112 |
MemoryUsageMonitor ProcessMonitor |
113 |
" |
|
114 |
! ! |
|
115 |
||
116 |
!MemoryMonitorView methodsFor:'drawing'! |
|
117 |
||
118 |
displayKilo:aNumber name:nm y:y |
|
119 |
|s| |
|
120 |
||
12731 | 121 |
"/ s := nm , (UnitConverter fileSizeStringFor:aNumber). |
122 |
aNumber >= (1024*1024*1024*8) ifTrue:[ |
|
12407 | 123 |
s := nm , ((aNumber // (1024*1024*1024)) printStringLeftPaddedTo:5) , 'G '. |
2363 | 124 |
] ifFalse:[ |
12407 | 125 |
aNumber >= (1024*1024*16) ifTrue:[ |
126 |
s := nm , ((aNumber // (1024*1024)) printStringLeftPaddedTo:5) , 'M '. |
|
127 |
] ifFalse:[ |
|
128 |
s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '. |
|
129 |
]. |
|
2363 | 130 |
]. |
131 |
self displayOpaqueString:s x:0 y:y. |
|
132 |
||
133 |
"Modified: / 23.9.1998 / 13:19:04 / cg" |
|
134 |
! |
|
135 |
||
17013 | 136 |
initializeDrawAction |
137 |
"extracted into a separate block to avoid memory allocation in updateDisplay" |
|
138 |
||
139 |
drawAction := |
|
140 |
[ |
|
141 |
|total oldSpaceUsed newSpaceUsed freeMem oldSpaceSize |
|
142 |
realOldSpaceSize symSpaceSize realOldSpaceUsed |
|
143 |
gWidth shift scaleChange margin| |
|
144 |
||
145 |
realOldSpaceSize := ObjectMemory oldSpaceSize. |
|
146 |
symSpaceSize := ObjectMemory symSpaceSize. |
|
147 |
realOldSpaceUsed := ObjectMemory oldSpaceUsed. |
|
148 |
||
149 |
oldSpaceUsed := realOldSpaceUsed + ObjectMemory symSpaceUsed. |
|
150 |
newSpaceUsed := ObjectMemory newSpaceUsed. |
|
151 |
freeMem := ObjectMemory freeListSpace + (realOldSpaceSize - realOldSpaceUsed). |
|
152 |
oldSpaceSize := realOldSpaceSize + symSpaceSize. |
|
153 |
total := oldSpaceSize + ObjectMemory newSpaceSize. |
|
154 |
||
155 |
scaleChange := false. |
|
156 |
||
157 |
((total - freeMem) < minTotal) ifTrue:[ |
|
158 |
minTotal := total - freeMem. |
|
159 |
scaleChange := true |
|
160 |
]. |
|
161 |
(total > maxTotal) ifTrue:[ |
|
162 |
maxTotal := total. |
|
163 |
scaleChange := true |
|
164 |
]. |
|
165 |
||
166 |
oldData at:updateIndex put:oldSpaceSize. "/ oldSpaceUsed. |
|
167 |
newData at:updateIndex put:newSpaceUsed. |
|
168 |
freeData at:updateIndex put:freeMem. |
|
169 |
updateIndex := updateIndex + 1. |
|
170 |
||
171 |
scaleChange ifTrue:[ |
|
172 |
scale := height asFloat / (maxTotal + 100000). |
|
173 |
self redraw |
|
174 |
]. |
|
175 |
||
176 |
gWidth := width - org. |
|
177 |
margin := 1. |
|
178 |
||
179 |
((updateIndex-1) >= (gWidth - margin)) ifTrue:[ |
|
180 |
"on slow displays, use:" |
|
181 |
"/ shift := gWidth // 4. |
|
182 |
||
183 |
"for smooth display, use:" |
|
184 |
shift := 1. |
|
185 |
||
186 |
oldData replaceFrom:1 with:oldData startingAt:shift+1. |
|
187 |
newData replaceFrom:1 with:newData startingAt:shift+1. |
|
188 |
freeData replaceFrom:1 with:freeData startingAt:shift+1. |
|
189 |
||
190 |
updateIndex := updateIndex - shift. |
|
191 |
dX := (dX ? 0) + shift. |
|
192 |
||
193 |
"/ before copying, handle any outstanding exposes ... |
|
194 |
self repairDamage. |
|
195 |
"/ self catchExpose. |
|
196 |
self |
|
197 |
copyFrom:self |
|
198 |
x:(org + shift) y:0 toX:org y:0 |
|
199 |
width:(gWidth - shift - margin) height:height |
|
200 |
async:false. |
|
201 |
||
202 |
self |
|
203 |
clearRectangleX:(width - margin - shift) y:0 |
|
204 |
width:shift height:height. |
|
205 |
||
206 |
"/ self waitForExpose. |
|
207 |
]. |
|
208 |
||
209 |
self |
|
210 |
updateLineX:(updateIndex - 1 + org - 1) |
|
211 |
total:total |
|
212 |
old:oldSpaceSize "/ oldSpaceUsed |
|
213 |
new:newSpaceUsed |
|
214 |
free:freeMem. |
|
215 |
||
216 |
self updateNumbers. |
|
217 |
self flush. |
|
218 |
]. |
|
219 |
! |
|
220 |
||
2363 | 221 |
redraw |
222 |
"redraw all" |
|
223 |
||
224 |
self clear. |
|
225 |
self redrawX:0 y:0 width:width height:height |
|
226 |
! |
|
227 |
||
228 |
redrawX:x y:y width:w height:h |
|
229 |
"redraw data" |
|
230 |
||
231 |
|total oldSpaceUsed newSpaceUsed freeMem lx startIdx endIdx |
|
232 |
right| |
|
233 |
||
234 |
shown ifFalse:[^ self]. |
|
235 |
||
236 |
right := x + w - 1. |
|
237 |
right >= org ifTrue:[ |
|
238 |
lx := x. |
|
239 |
lx < org ifTrue:[ |
|
240 |
lx := org |
|
241 |
]. |
|
242 |
||
243 |
total := ObjectMemory symSpaceSize |
|
244 |
+ ObjectMemory oldSpaceSize |
|
245 |
+ ObjectMemory newSpaceSize. |
|
246 |
||
247 |
startIdx := (lx-org+1). |
|
248 |
startIdx < 1 ifTrue:[ |
|
249 |
startIdx := 1 |
|
250 |
]. |
|
251 |
||
252 |
endIdx := right-org+1. |
|
253 |
endIdx >= updateIndex ifTrue:[ |
|
254 |
endIdx := updateIndex-1. |
|
255 |
]. |
|
256 |
dX := 0. |
|
257 |
||
258 |
startIdx to:endIdx do:[:i | |
|
259 |
newSpaceUsed := newData at:i. |
|
260 |
newSpaceUsed notNil ifTrue:[ |
|
261 |
oldSpaceUsed := oldData at:i. |
|
262 |
freeMem := freeData at:i. |
|
263 |
||
264 |
self updateLineX:lx - dX |
|
265 |
total:total |
|
266 |
old:oldSpaceUsed |
|
267 |
new:newSpaceUsed |
|
268 |
free:freeMem. |
|
269 |
]. |
|
270 |
lx := lx + 1 |
|
271 |
] |
|
272 |
]. |
|
273 |
||
274 |
x < org ifTrue:[ |
|
275 |
"/ force redraw. |
|
276 |
||
12408 | 277 |
prevFree := prevFree2 := prevOld := prevTotal := prevLimit := nil. |
2363 | 278 |
prevMemUsed := prevCodeUsed := prevNumWeak := prevNumRem := nil. |
279 |
prevNumLifoRem := prevTenureAge := prevIGCPhase := nil. |
|
280 |
prevLastScavengeReclamation := prevMinScavengeReclamation := nil. |
|
281 |
prevScavengeCount := nil. |
|
282 |
||
283 |
self updateNumbers. |
|
284 |
] |
|
285 |
||
286 |
"Modified: / 14.7.1998 / 23:33:47 / cg" |
|
287 |
! |
|
288 |
||
289 |
updateDisplay |
|
290 |
"update picture; trigger next update" |
|
291 |
||
292 |
shown ifTrue:[ |
|
293 |
drawLock wouldBlock ifFalse:[ |
|
17013 | 294 |
drawLock critical:drawAction. |
2363 | 295 |
]. |
296 |
]. |
|
297 |
||
298 |
updateBlock notNil ifTrue:[ |
|
299 |
Processor addTimedBlock:updateBlock afterSeconds:updateInterval |
|
300 |
]. |
|
301 |
||
302 |
"Modified: / 5.8.1998 / 13:13:18 / cg" |
|
303 |
! |
|
304 |
||
305 |
updateLineX:x total:total old:oldSpaceSize new:newSpaceUsed free:freeMem |
|
306 |
|hNew hOld hFree y1 y2 y3| |
|
307 |
||
308 |
hNew := (newSpaceUsed * scale) asInteger. |
|
309 |
hOld := (oldSpaceSize * scale) // 2. |
|
310 |
hFree := (freeMem * scale) // 2. |
|
311 |
||
312 |
y1 := height - 1. |
|
313 |
||
314 |
y2 := y1 - hOld. |
|
315 |
self paint:oldColor. |
|
316 |
self displayLineFromX:x y:y1 toX:x y:y2. |
|
317 |
||
318 |
y3 := y1 - hFree. |
|
319 |
self paint:freeColor. |
|
320 |
self displayLineFromX:x y:y1 toX:x y:y3. |
|
321 |
||
322 |
y1 := y2 - hNew. |
|
323 |
y1 ~= y2 ifTrue:[ |
|
324 |
self paint:newColor. |
|
325 |
self displayLineFromX:x y:y1 toX:x y:y2. |
|
326 |
] |
|
327 |
||
328 |
"Modified: / 29.1.1999 / 20:45:07 / stefan" |
|
329 |
! |
|
330 |
||
331 |
updateNumbers |
|
332 |
"redraw numbers. |
|
333 |
The values shown are: |
|
334 |
max: maximum memory used since monitor started |
|
335 |
min: minimum memory used since monitor started |
|
336 |
tot: total memory used (overall oldSpace + overall newSpace) |
|
337 |
all: current memory in use (oldSpace + newSpace) |
|
338 |
new: current newSpace in use |
|
339 |
fre: current size of freelist in oldSpace |
|
340 |
old: current oldSpace in use |
|
12731 | 341 |
mal: net allocated by malloc |
10570 | 342 |
mto: brutto memory reserved by malloc |
2363 | 343 |
code: current just-in-time compiled code cache size |
344 |
t: current tenure age |
|
345 |
I: IGC state |
|
346 |
weak: number of weak arrays in the system |
|
347 |
rem remembered set size |
|
348 |
lrem lifo remembered set size |
|
349 |
minsc: percent of newspace remaining after scavenge (worst case) |
|
350 |
irq: max. interrupt delay |
|
351 |
count of scavenges / last scavenge survivor rate |
|
352 |
||
353 |
" |
|
354 |
||
10570 | 355 |
|oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2 |
356 |
mallocAllocated mallocTotal |
|
2363 | 357 |
codeUsed numWeak numRem numLifoRem tenureAge igcPhase |
358 |
minScavengeReclamation lastScavengeReclamation scavengeCount |
|
17013 | 359 |
y half s font fontHeight fontAscent fontDescent |
12407 | 360 |
limit total n prevMallocAllocated prevMallocTotal| |
2363 | 361 |
|
362 |
oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed. |
|
363 |
newMemUsed := ObjectMemory newSpaceUsed. |
|
364 |
freeMem := ObjectMemory freeListSpace. |
|
365 |
oldSpaceSize := ObjectMemory oldSpaceSize + ObjectMemory symSpaceSize. |
|
366 |
newSpaceSize := ObjectMemory newSpaceSize. |
|
367 |
||
10570 | 368 |
mallocAllocated := ObjectMemory mallocAllocated. |
369 |
mallocTotal := ObjectMemory mallocTotal. |
|
12407 | 370 |
limit := ObjectMemory maxOldSpace. |
10570 | 371 |
|
2363 | 372 |
memUsed := oldMemUsed + newMemUsed "- freeMem". |
373 |
total := oldSpaceSize + newSpaceSize. |
|
374 |
free2 := ObjectMemory freeSpace. |
|
375 |
||
13959 | 376 |
self paint:self whiteColor on:self blackColor. |
2363 | 377 |
|
17013 | 378 |
font := gc font. |
379 |
fontDescent := font descent. |
|
380 |
fontAscent := font ascent. |
|
381 |
fontHeight := font height + fontDescent. |
|
2363 | 382 |
half := height // 2 + fontDescent. |
383 |
||
10573 | 384 |
y := half - (fontHeight * 8). |
2363 | 385 |
|
12408 | 386 |
limit ~~ prevLimit ifTrue:[ |
387 |
self displayKilo:limit name:'lim ' y:fontAscent. |
|
388 |
prevLimit := limit. |
|
389 |
]. |
|
2363 | 390 |
total ~~ prevTotal ifTrue:[ |
391 |
((total - freeMem) < minTotal) ifTrue:[ |
|
392 |
minTotal := total - freeMem. |
|
393 |
]. |
|
394 |
(total > maxTotal) ifTrue:[ |
|
395 |
maxTotal := total. |
|
396 |
]. |
|
397 |
||
12407 | 398 |
self displayKilo:maxTotal name:'max ' y:fontAscent + fontHeight. |
399 |
self displayKilo:minTotal name:'min ' y:(height - fontDescent). |
|
2363 | 400 |
self displayKilo:total name:'tot ' y:y. |
401 |
||
402 |
prevTotal := total. |
|
403 |
]. |
|
404 |
||
405 |
y := y + fontHeight. |
|
406 |
memUsed ~~ prevMemUsed ifTrue:[ |
|
407 |
self displayKilo:memUsed name:'all ' y:y. |
|
408 |
prevMemUsed := memUsed. |
|
409 |
]. |
|
410 |
||
411 |
y := y + fontHeight. |
|
412 |
self paint:newColor. |
|
413 |
self displayKilo:newMemUsed name:'new ' y:y. |
|
414 |
||
415 |
y := y + fontHeight. |
|
416 |
freeMem ~~ prevFree ifTrue:[ |
|
417 |
self paint:freeColor. |
|
418 |
self displayKilo:freeMem name:'frl ' y:y. |
|
419 |
prevFree := freeMem. |
|
420 |
]. |
|
421 |
||
422 |
y := y + fontHeight. |
|
423 |
free2 ~~ prevFree2 ifTrue:[ |
|
424 |
self paint:freeColor. |
|
425 |
self displayKilo:free2 name:'fre ' y:y. |
|
426 |
prevFree2 := free2. |
|
427 |
]. |
|
428 |
||
429 |
y := y + fontHeight. |
|
430 |
(oldMemUsed - freeMem) ~~ prevOld ifTrue:[ |
|
431 |
self paint:oldColor. |
|
432 |
self displayKilo:(oldMemUsed - freeMem) name:'old ' y:y. |
|
433 |
prevOld := (oldMemUsed - freeMem). |
|
434 |
]. |
|
435 |
||
436 |
y := y + fontHeight. |
|
10570 | 437 |
mallocAllocated ~~ prevMallocAllocated ifTrue:[ |
438 |
self paint:mallocColor. |
|
439 |
self displayKilo:mallocAllocated name:'mal ' y:y. |
|
440 |
prevMallocAllocated := mallocAllocated. |
|
441 |
]. |
|
442 |
||
443 |
y := y + fontHeight. |
|
444 |
mallocTotal ~~ prevMallocTotal ifTrue:[ |
|
445 |
self paint:mallocColor. |
|
446 |
self displayKilo:mallocTotal name:'mto ' y:y. |
|
447 |
prevMallocTotal := mallocTotal. |
|
448 |
]. |
|
449 |
||
450 |
y := y + fontHeight. |
|
2363 | 451 |
ObjectMemory supportsJustInTimeCompilation ifTrue:[ |
452 |
codeUsed := ObjectMemory compiledCodeSpaceUsed. |
|
453 |
prevCodeUsed ~~ codeUsed ifTrue:[ |
|
454 |
self paint:oldColor. |
|
455 |
codeUsed > 9999 ifTrue:[ |
|
456 |
s := 'code ' , ((codeUsed // 1024) printStringLeftPaddedTo:4) , 'k'. |
|
457 |
] ifFalse:[ |
|
10573 | 458 |
s := 'code ' , (codeUsed printStringLeftPaddedTo:4) , 'b'. |
2363 | 459 |
]. |
460 |
self displayOpaqueString:s x:0 y:y. |
|
461 |
prevCodeUsed := codeUsed. |
|
462 |
] |
|
463 |
]. |
|
464 |
||
465 |
" |
|
466 |
the following is internal - normally only interesting when debugging the VM |
|
467 |
" |
|
468 |
y := y + fontHeight. |
|
469 |
tenureAge := ObjectMemory tenureAge. |
|
470 |
igcPhase := ObjectMemory incrementalGCPhase. |
|
471 |
(prevTenureAge ~~ tenureAge |
|
472 |
or:[prevIGCPhase ~~ igcPhase]) ifTrue:[ |
|
473 |
self paint:oldColor. |
|
474 |
s := 't:' , (tenureAge printStringLeftPaddedTo:2) , ' '. |
|
475 |
s := s , ' I:' , (igcPhase printStringLeftPaddedTo:2) , ' '. |
|
476 |
self displayOpaqueString:s x:0 y:y. |
|
477 |
prevTenureAge := tenureAge. |
|
478 |
prevIGCPhase := igcPhase. |
|
479 |
]. |
|
480 |
||
481 |
y := y + fontHeight. |
|
482 |
numWeak := ObjectMemory numberOfWeakObjects. |
|
483 |
prevNumWeak ~~ numWeak ifTrue:[ |
|
484 |
self paint:oldColor. |
|
485 |
s := 'weak: ' , (numWeak printStringLeftPaddedTo:4). |
|
486 |
self displayOpaqueString:s x:0 y:y. |
|
487 |
prevNumWeak := numWeak. |
|
488 |
]. |
|
489 |
||
490 |
y := y + fontHeight. |
|
491 |
numRem := ObjectMemory rememberedSetSize. |
|
492 |
prevNumRem ~~ numRem ifTrue:[ |
|
493 |
self paint:oldColor. |
|
494 |
s := 'rem: ' , (numRem printStringLeftPaddedTo:5). |
|
495 |
self displayOpaqueString:s x:0 y:y. |
|
496 |
prevNumRem := numRem. |
|
497 |
]. |
|
498 |
||
499 |
y := y + fontHeight. |
|
500 |
numLifoRem := ObjectMemory lifoRememberedSetSize. |
|
501 |
prevNumLifoRem ~~ numLifoRem ifTrue:[ |
|
502 |
self paint:oldColor. |
|
503 |
s := 'lrem: ' , (numLifoRem printStringLeftPaddedTo:4 ifLarger:['****']). |
|
504 |
self displayOpaqueString:s x:0 y:y. |
|
505 |
prevNumLifoRem := numLifoRem. |
|
506 |
]. |
|
507 |
||
508 |
"/ does no longer make sense to show .... |
|
509 |
"/ y := y + fontHeight. |
|
510 |
"/ ObjectMemory runsSingleOldSpace ifTrue:[ |
|
511 |
"/ self displayOpaqueString:'single' x:0 y:(half + (fontHeight*4)). |
|
512 |
"/ ]. |
|
513 |
||
514 |
y := y + fontHeight. |
|
515 |
minScavengeReclamation := ObjectMemory minScavengeReclamation * 100 // ObjectMemory newSpaceSize. |
|
516 |
prevMinScavengeReclamation ~~ minScavengeReclamation ifTrue:[ |
|
517 |
minScavengeReclamation := 100 - minScavengeReclamation asInteger. |
|
518 |
s := 'minSc ', (minScavengeReclamation printStringLeftPaddedTo:3) , '%'. |
|
519 |
self paint:oldColor. |
|
520 |
self displayOpaqueString:s x:0 y:y. |
|
521 |
prevMinScavengeReclamation := minScavengeReclamation. |
|
522 |
]. |
|
523 |
||
524 |
y := y + fontHeight. |
|
525 |
n := ObjectMemory maxInterruptLatency. |
|
526 |
n notNil ifTrue:[ |
|
527 |
s := 'irq ', (n printStringLeftPaddedTo:3) , ' ms'. |
|
528 |
] ifFalse:[ |
|
529 |
s := '' |
|
530 |
]. |
|
531 |
self displayOpaqueString:s x:0 y:y. |
|
532 |
||
533 |
y := y + fontHeight. |
|
534 |
scavengeCount := ObjectMemory scavengeCount. |
|
535 |
lastScavengeReclamation := ObjectMemory lastScavengeReclamation * 100 // ObjectMemory newSpaceSize. |
|
536 |
(prevScavengeCount ~~ scavengeCount |
|
537 |
or:[prevLastScavengeReclamation ~~ lastScavengeReclamation]) ifTrue:[ |
|
538 |
lastScavengeReclamation := 100 - lastScavengeReclamation asInteger. |
|
539 |
s := (scavengeCount printStringLeftPaddedTo:6) |
|
540 |
, (lastScavengeReclamation printStringLeftPaddedTo:3) , '%'. |
|
541 |
self displayOpaqueString:s x:0 y:y. |
|
542 |
prevLastScavengeReclamation := lastScavengeReclamation. |
|
543 |
prevScavengeCount := scavengeCount. |
|
544 |
]. |
|
545 |
||
546 |
"Created: / 7.11.1995 / 14:48:16 / cg" |
|
547 |
"Modified: / 14.7.1998 / 23:35:53 / cg" |
|
548 |
! ! |
|
549 |
||
550 |
!MemoryMonitorView methodsFor:'events'! |
|
551 |
||
552 |
keyPress:key x:x y:y |
|
553 |
key == $f ifTrue:[ |
|
554 |
"faster" |
|
555 |
updateInterval := updateInterval / 2 |
|
556 |
]. |
|
557 |
key == $s ifTrue:[ |
|
558 |
"slower" |
|
559 |
updateInterval := updateInterval * 2 |
|
560 |
]. |
|
561 |
key == $r ifTrue:[ |
|
562 |
"reset max" |
|
563 |
maxTotal := prevTotal. |
|
564 |
scale := height asFloat / (maxTotal + 100000). |
|
565 |
self resetStatisticValues. |
|
566 |
self redraw. |
|
567 |
] |
|
568 |
||
569 |
"Modified: 7.11.1995 / 17:45:13 / cg" |
|
570 |
! |
|
571 |
||
572 |
sizeChanged:how |
|
573 |
|nn no nf delta oldSize newSize| |
|
574 |
||
575 |
super sizeChanged:how. |
|
576 |
||
577 |
(width == 0 or:[height == 0]) ifTrue:[ |
|
2369 | 578 |
^ self |
2363 | 579 |
]. |
580 |
||
581 |
oldSize := oldData size. |
|
582 |
newSize := width-org+1. |
|
2369 | 583 |
newSize <= 0 ifTrue:[^ self]. |
2363 | 584 |
|
585 |
(newSize ~~ oldSize) ifTrue:[ |
|
586 |
nn := Array new:newSize. |
|
587 |
no := Array new:newSize. |
|
588 |
nf := Array new:newSize. |
|
589 |
||
590 |
(newSize > oldSize) ifTrue:[ |
|
591 |
nn replaceFrom:1 to:oldSize with:newData. |
|
592 |
no replaceFrom:1 to:oldSize with:oldData. |
|
593 |
nf replaceFrom:1 to:oldSize with:freeData |
|
594 |
] ifFalse:[ |
|
595 |
delta := (oldSize - newSize). |
|
596 |
nn replaceFrom:1 with:newData startingAt:delta+1. |
|
597 |
no replaceFrom:1 with:oldData startingAt:delta+1. |
|
598 |
nf replaceFrom:1 with:freeData startingAt:delta+1. |
|
599 |
updateIndex > newSize ifTrue:[ |
|
600 |
updateIndex := updateIndex - delta. |
|
601 |
] |
|
602 |
]. |
|
603 |
newData := nn. |
|
604 |
oldData := no. |
|
605 |
freeData := nf. |
|
606 |
||
607 |
scale := height asFloat / (maxTotal + 100000). |
|
608 |
]. |
|
609 |
self clear. |
|
610 |
self redraw. |
|
611 |
||
612 |
"Modified: / 7.9.1998 / 21:41:13 / cg" |
|
613 |
! ! |
|
614 |
||
6297 | 615 |
!MemoryMonitorView methodsFor:'initialization & release'! |
2363 | 616 |
|
617 |
destroy |
|
618 |
updateBlock notNil ifTrue:[ |
|
2370 | 619 |
Processor removeTimedBlock:updateBlock. |
2363 | 620 |
] ifFalse:[ |
2370 | 621 |
myProcess notNil ifTrue:[ |
622 |
myProcess terminate. |
|
623 |
myProcess := nil |
|
624 |
] |
|
2363 | 625 |
]. |
626 |
oldData := newData := freeData := nil. |
|
627 |
super destroy |
|
628 |
! |
|
629 |
||
630 |
initialize |
|
631 |
super initialize. |
|
632 |
||
17013 | 633 |
self initializeDrawAction. |
634 |
||
2363 | 635 |
drawLock := Semaphore forMutualExclusion name:'drawLock'. |
636 |
||
637 |
updateInterval := 0.5. |
|
638 |
ProcessorScheduler isPureEventDriven ifTrue:[ |
|
639 |
updateBlock := [self updateDisplay]. |
|
640 |
]. |
|
641 |
oldData := Array new:1000. |
|
642 |
newData := Array new:1000. |
|
643 |
freeData := Array new:1000. |
|
644 |
||
645 |
updateIndex := 1. |
|
646 |
||
16251 | 647 |
self font:((Font family:'courier' face:'medium' style:'roman' size:10) onDevice:device). |
13957 | 648 |
org := gc font widthOf:'max 99999k '. |
2363 | 649 |
level := 0. |
650 |
||
651 |
maxTotal := minTotal := ObjectMemory oldSpaceSize |
|
652 |
+ ObjectMemory symSpaceSize |
|
653 |
+ ObjectMemory newSpaceSize. |
|
654 |
||
13960 | 655 |
viewBackground := self blackColor. |
2363 | 656 |
|
16242 | 657 |
device hasColors ifTrue:[ |
2363 | 658 |
newColor := Color orange. "/ yellow. |
659 |
freeColor := Color green. |
|
10570 | 660 |
mallocColor := Color yellow. |
2363 | 661 |
] ifFalse:[ |
662 |
newColor := Color grey:67. |
|
663 |
freeColor := Color grey:33. |
|
10570 | 664 |
mallocColor := Color grey:50. |
2363 | 665 |
]. |
16743 | 666 |
oldColor := self whiteColor. |
2363 | 667 |
|
668 |
self model:self. |
|
669 |
self menu:#memoryMenu |
|
670 |
||
671 |
" |
|
672 |
MemoryMonitor open |
|
673 |
" |
|
674 |
||
10384 | 675 |
"Modified: / 24-07-2011 / 08:28:51 / cg" |
2363 | 676 |
! |
677 |
||
678 |
realize |
|
13957 | 679 |
|graphicsDevice| |
680 |
||
2363 | 681 |
super realize. |
682 |
updateBlock notNil ifTrue:[ |
|
683 |
Processor addTimedBlock:updateBlock afterSeconds:updateInterval. |
|
684 |
] ifFalse:[ |
|
8655 | 685 |
(myProcess isNil or:[myProcess isDead]) ifTrue:[ |
686 |
myProcess := [ |
|
687 |
[ |
|
688 |
self updateProcess |
|
689 |
] ensure:[ |
|
690 |
myProcess := nil. |
|
691 |
]. |
|
692 |
] newProcess. |
|
693 |
myProcess priorityRange:(6 to:8). |
|
694 |
myProcess name:'monitor [' , |
|
695 |
Processor activeProcessId printString , |
|
696 |
'] update'. |
|
697 |
myProcess restartable:true. |
|
698 |
myProcess resume. |
|
699 |
]. |
|
2363 | 700 |
]. |
701 |
||
16242 | 702 |
graphicsDevice := device. |
13957 | 703 |
newColor := newColor onDevice:graphicsDevice. |
704 |
freeColor := freeColor onDevice:graphicsDevice. |
|
705 |
oldColor := oldColor onDevice:graphicsDevice. |
|
706 |
mallocColor := mallocColor onDevice:graphicsDevice. |
|
2363 | 707 |
|
708 |
"Modified: / 23.9.1998 / 12:41:10 / cg" |
|
709 |
! |
|
710 |
||
711 |
reinitStyle |
|
712 |
"ignore style changes" |
|
713 |
||
714 |
"Created: / 15.9.1998 / 15:22:46 / cg" |
|
715 |
! ! |
|
716 |
||
717 |
!MemoryMonitorView methodsFor:'menu functions'! |
|
718 |
||
719 |
backgroundCollect |
|
720 |
"start a background (non disturbing) incremental GC. |
|
721 |
Since the GC is performed at a low priority, it may not make progress if higher |
|
722 |
prio processes are running" |
|
723 |
||
724 |
[ |
|
725 |
ObjectMemory incrementalGC |
|
726 |
] forkAt:5 |
|
727 |
! |
|
728 |
||
729 |
backgroundCollectWithDynamicPrio |
|
730 |
"setup the background collector to run at dynamic priority. |
|
731 |
This is a new experimental feature." |
|
732 |
||
733 |
Processor isTimeSlicing ifFalse:[ |
|
734 |
Processor startTimeSlicing. |
|
735 |
Processor supportDynamicPriorities:true |
|
736 |
]. |
|
737 |
||
738 |
ObjectMemory backgroundCollectProcess priorityRange:(5 to:9). |
|
739 |
ObjectMemory backgroundFinalizationProcess priorityRange:(5 to:9). |
|
740 |
||
741 |
"Modified: / 4.8.1998 / 02:16:02 / cg" |
|
742 |
! |
|
743 |
||
744 |
backgroundCollectWithFixPrio |
|
745 |
"setup the background collector to run at a fix priority. |
|
746 |
This is the default." |
|
747 |
||
748 |
ObjectMemory backgroundCollectProcess priorityRange:nil. |
|
749 |
ObjectMemory backgroundFinalizationProcess priorityRange:nil. |
|
750 |
||
751 |
"Modified: / 4.8.1998 / 02:00:31 / cg" |
|
752 |
! |
|
753 |
||
754 |
cleanupMemory |
|
755 |
"let all classes release unneeded, cached |
|
756 |
data ..." |
|
757 |
||
758 |
ObjectMemory performLowSpaceCleanup. |
|
759 |
||
760 |
" |
|
761 |
then, perform a GC (incl. symbol reclamation) |
|
762 |
" |
|
763 |
ObjectMemory reclaimSymbols. |
|
764 |
" |
|
765 |
finally, compress |
|
766 |
" |
|
767 |
ObjectMemory tenure. |
|
768 |
ObjectMemory verboseGarbageCollect. |
|
769 |
||
770 |
"Modified: 26.6.1997 / 17:12:53 / cg" |
|
771 |
! |
|
772 |
||
773 |
cleanupMethodHistory |
|
774 |
"release the oldMethod history" |
|
775 |
||
776 |
(self confirm:'This removes the previous method history, |
|
777 |
which is kept for all changed methods in the system. |
|
778 |
After that, the browsers cannot easily switch back to a methods |
|
779 |
previous version. |
|
780 |
||
781 |
However, this is normally not a problem, since |
|
16091 | 782 |
a methods previous code should still be accessible through |
2363 | 783 |
either the changes-file, the sourceCode repository or the classes original |
784 |
source file. |
|
785 |
||
786 |
cleanup now ?') ifTrue:[ |
|
787 |
||
788 |
||
789 |
Class flushMethodHistory. |
|
790 |
||
791 |
" |
|
792 |
then, perform a GC (incl. symbol reclamation) |
|
793 |
" |
|
794 |
ObjectMemory reclaimSymbols. |
|
795 |
" |
|
796 |
finally, compress |
|
797 |
" |
|
798 |
ObjectMemory verboseGarbageCollect. |
|
799 |
] |
|
800 |
! |
|
801 |
||
802 |
collectGarbage |
|
803 |
"perform a blocking (non compressing) garbage collect" |
|
804 |
||
805 |
windowGroup withWaitCursorDo:[ |
|
806 |
ObjectMemory tenure. |
|
807 |
ObjectMemory markAndSweep |
|
808 |
] |
|
809 |
||
810 |
"Modified: 30.7.1997 / 21:19:35 / cg" |
|
811 |
! |
|
812 |
||
813 |
collectGarbageAndCompress |
|
814 |
"perform a blocking compressing garbage collect." |
|
815 |
||
816 |
windowGroup withWaitCursorDo:[ |
|
817 |
ObjectMemory tenure. |
|
818 |
ObjectMemory verboseGarbageCollect |
|
819 |
] |
|
820 |
||
821 |
"Modified: 30.7.1997 / 21:19:47 / cg" |
|
822 |
! |
|
823 |
||
824 |
collectGarbageAndSymbols |
|
825 |
"perform a blocking (non compressing) garbage collect |
|
826 |
and reclaim unreferenced symbols." |
|
827 |
||
828 |
windowGroup withWaitCursorDo:[ |
|
829 |
ObjectMemory tenure. |
|
830 |
ObjectMemory reclaimSymbols |
|
831 |
] |
|
832 |
||
833 |
"Modified: 30.7.1997 / 21:19:41 / cg" |
|
834 |
! |
|
835 |
||
13755 | 836 |
compressOldSpace |
837 |
"perform a blocking compress (only useful if freeList is not empty, after M&S)" |
|
838 |
||
839 |
windowGroup withWaitCursorDo:[ |
|
840 |
ObjectMemory compressOldSpace. |
|
841 |
] |
|
842 |
||
843 |
"Modified: 30.7.1997 / 21:19:35 / cg" |
|
844 |
! |
|
845 |
||
2363 | 846 |
compressSources |
847 |
(self confirm:'This saves all in-memory source strings into a file |
|
848 |
and makes methods reference these (file-) strings, |
|
849 |
freeing all in-memory sources. |
|
850 |
||
851 |
If that source file is ever lost or gets out of sync with |
|
852 |
your system, those method sources are lost and the browser |
|
853 |
will show garbage. |
|
854 |
However, you still have a change file as backup. |
|
855 |
||
856 |
(Be especially careful, if you move images around: |
|
857 |
the source file must then be the correct one for that image) |
|
858 |
||
859 |
A compress is only useful, if you added many methods |
|
860 |
and the systems response time suffers from paging. |
|
861 |
||
862 |
Compress anyway ?') ifTrue:[ |
|
863 |
windowGroup withWaitCursorDo:[ |
|
864 |
Smalltalk compressSources. |
|
865 |
ObjectMemory markAndSweep |
|
866 |
] |
|
867 |
] |
|
868 |
||
869 |
"Modified: 9.2.1996 / 18:17:22 / cg" |
|
870 |
! |
|
871 |
||
872 |
incrementalCollect |
|
873 |
"start an incremental GC which does not disturb too much, but is guaranteed to |
|
874 |
make progress. |
|
875 |
This is done by doing the IGC at a very high priority, but giving up the CPU after |
|
876 |
every step. Due to the long delays, this may take a while to finish. |
|
877 |
Notice, that this is different from doing a background collect: that one |
|
878 |
may not make any progress if higher prio processes are runnable." |
|
879 |
||
880 |
|done delay| |
|
881 |
||
882 |
[ |
|
883 |
done := false. |
|
884 |
delay := Delay new. |
|
885 |
[done] whileFalse:[ |
|
886 |
10 timesRepeat:[ |
|
887 |
done ifFalse:[done := ObjectMemory gcStep]. |
|
888 |
]. |
|
889 |
(delay delay:10) wait |
|
890 |
] |
|
891 |
] forkAt:Processor highestPriority |
|
892 |
||
893 |
"Modified: 23.12.1995 / 17:31:55 / cg" |
|
894 |
! |
|
895 |
||
8650
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
896 |
memoryMenu |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
897 |
<resource: #programMenu> |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
898 |
|
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
899 |
|hasSpecialMenu m items moreItems specialMenu| |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
900 |
|
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
901 |
hasSpecialMenu := Smalltalk isStandAloneApp not. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
902 |
hasSpecialMenu ifTrue:[ |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
903 |
items := #( |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
904 |
('Background Collect Now' backgroundCollect) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
905 |
('Hi Prio Incremental Collect' incrementalCollect) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
906 |
('-') |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
907 |
('Scavenge' scavenge) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
908 |
('Tenure' tenure) |
13756 | 909 |
('Compress Only' compressOldSpace) |
8650
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
910 |
('-') |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
911 |
('Cleanup Memory' cleanupMemory) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
912 |
('Flush Method History' cleanupMethodHistory) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
913 |
('Unload Autoloaded Classes' unloadAllAutoloadedClasses) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
914 |
('-') |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
915 |
('Compress Sources' compressSources) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
916 |
). |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
917 |
|
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
918 |
ObjectMemory backgroundCollectorRunning ifFalse:[ |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
919 |
moreItems := #( |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
920 |
('Start Background Collector' restartBackgroundCollector ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
921 |
) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
922 |
] ifTrue:[ |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
923 |
(ObjectMemory backgroundCollectProcess priorityRange notNil) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
924 |
ifTrue:[ |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
925 |
moreItems := #( |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
926 |
('Stop Background Collector' stopBackgroundCollector ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
927 |
('Background Collect with Fix Priority' backgroundCollectWithFixPrio ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
928 |
) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
929 |
] ifFalse:[ |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
930 |
moreItems := #( |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
931 |
('Stop Background Collector' stopBackgroundCollector ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
932 |
('Background Collect with Dynamic Priority' backgroundCollectWithDynamicPrio ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
933 |
) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
934 |
]. |
9542 | 935 |
ObjectMemory backgroundFinalizationProcess isNil ifTrue:[ |
936 |
moreItems := moreItems , #( |
|
937 |
('Start Background Finalizer' restartBackgroundFinalizer ) |
|
938 |
) |
|
939 |
]. |
|
940 |
||
8650
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
941 |
]. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
942 |
items := moreItems , items. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
943 |
|
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
944 |
specialMenu := PopUpMenu |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
945 |
itemList:items |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
946 |
resources:resources. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
947 |
|
13957 | 948 |
self sensor ctrlDown ifTrue:[ |
8650
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
949 |
^ specialMenu |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
950 |
]. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
951 |
|
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
952 |
items := #( |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
953 |
('Collect Garbage' collectGarbage ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
954 |
('Collect Garbage & Symbols' collectGarbageAndSymbols ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
955 |
('Collect Garbage & Compress' collectGarbageAndCompress ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
956 |
('-') |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
957 |
('Reset Statistic Values' resetStatisticValues ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
958 |
('-') |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
959 |
('Others' otherMenu Ctrl) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
960 |
). |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
961 |
|
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
962 |
m := PopUpMenu itemList:items resources:resources. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
963 |
m subMenuAt:#otherMenu put:specialMenu. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
964 |
] ifFalse:[ |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
965 |
items := #( |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
966 |
('Collect Garbage' collectGarbage ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
967 |
('Collect Garbage & Symbols' collectGarbageAndSymbols ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
968 |
('Collect Garbage & Compress' collectGarbageAndCompress ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
969 |
('-') |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
970 |
('Reset Statistic Values' resetStatisticValues ) |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
971 |
). |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
972 |
m := PopUpMenu itemList:items resources:resources. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
973 |
]. |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
974 |
|
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
975 |
^ m |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
976 |
|
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
977 |
"Modified: / 5.8.1998 / 15:35:14 / cg" |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
978 |
! |
9c4626c21c7b
do not show source-code related menu items if in a standalon app.
Claus Gittinger <cg@exept.de>
parents:
6297
diff
changeset
|
979 |
|
2363 | 980 |
resetStatisticValues |
981 |
ObjectMemory resetMaxInterruptLatency. |
|
982 |
ObjectMemory resetMinScavengeReclamation. |
|
983 |
||
984 |
"Created: 7.11.1995 / 17:44:59 / cg" |
|
985 |
! |
|
986 |
||
987 |
restartBackgroundCollector |
|
988 |
"(re)start a background (non disturbing) incremental GC. |
|
989 |
Since the GC is performed at a low priority, it may not make progress if higher |
|
990 |
prio processes are running" |
|
991 |
||
992 |
ObjectMemory backgroundCollectorRunning |
|
993 |
ifFalse:[ |
|
994 |
ObjectMemory startBackgroundCollectorAt:5. |
|
995 |
ObjectMemory startBackgroundFinalizationAt:5 |
|
996 |
] |
|
997 |
||
998 |
"Created: / 21.1.1997 / 00:09:30 / cg" |
|
999 |
"Modified: / 5.8.1998 / 14:30:17 / cg" |
|
1000 |
! |
|
1001 |
||
9542 | 1002 |
restartBackgroundFinalizer |
1003 |
"(re)start a background (non disturbing) incremental finalizer process." |
|
1004 |
||
1005 |
ObjectMemory backgroundFinalizationProcess isNil |
|
1006 |
ifTrue:[ |
|
1007 |
ObjectMemory startBackgroundFinalizationAt:5 |
|
1008 |
] |
|
1009 |
||
1010 |
"Created: / 21.1.1997 / 00:09:30 / cg" |
|
1011 |
"Modified: / 5.8.1998 / 14:30:17 / cg" |
|
1012 |
! |
|
1013 |
||
2363 | 1014 |
scavenge |
1015 |
"perform a blocking newspace garbage collect. |
|
1016 |
(this is for debugging only - the system does this automatically)" |
|
1017 |
||
1018 |
ObjectMemory scavenge |
|
1019 |
! |
|
1020 |
||
1021 |
stopBackgroundCollector |
|
1022 |
"stop the background (non disturbing) incremental GC. |
|
1023 |
We do not recommend this - but maybe useful for debugging and |
|
1024 |
evaluating the programs behavior in heavy-load situations |
|
1025 |
(background collector cannot keep up with the allocation rate)" |
|
1026 |
||
1027 |
ObjectMemory stopBackgroundCollector. |
|
1028 |
ObjectMemory stopBackgroundFinalization |
|
1029 |
||
1030 |
"Created: / 5.8.1998 / 14:29:40 / cg" |
|
1031 |
! |
|
1032 |
||
1033 |
tenure |
|
1034 |
"empty the newSpace, by aging all new objects immediately and transfering them |
|
1035 |
into oldSpace. |
|
1036 |
(this is for debugging only - the system does this automatically)" |
|
1037 |
||
1038 |
ObjectMemory tenure |
|
1039 |
! |
|
1040 |
||
1041 |
unloadAllAutoloadedClasses |
|
1042 |
"unload all classes which were autoloaded and have no instances" |
|
1043 |
||
1044 |
Autoload loadedClasses copy do:[:anAutoloadedClass | |
|
1045 |
anAutoloadedClass hasInstances ifFalse:[ |
|
1046 |
anAutoloadedClass unload |
|
1047 |
] |
|
1048 |
]. |
|
1049 |
||
1050 |
"Created: 27.6.1997 / 14:21:45 / cg" |
|
1051 |
"Modified: 27.6.1997 / 14:22:47 / cg" |
|
1052 |
! ! |
|
1053 |
||
1054 |
!MemoryMonitorView methodsFor:'private'! |
|
1055 |
||
1056 |
updateProcess |
|
1057 |
[true] whileTrue:[ |
|
1058 |
Delay waitForSeconds:updateInterval. |
|
1059 |
self updateDisplay |
|
1060 |
] |
|
1061 |
||
1062 |
"Modified: / 23.9.1998 / 12:40:31 / cg" |
|
1063 |
! ! |
|
1064 |
||
1065 |
!MemoryMonitorView class methodsFor:'documentation'! |
|
1066 |
||
1067 |
version |
|
16091 | 1068 |
^ '$Header$' |
9542 | 1069 |
! |
1070 |
||
1071 |
version_CVS |
|
16091 | 1072 |
^ '$Header$' |
2363 | 1073 |
! ! |
12407 | 1074 |