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