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