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