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