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