12 "{ Package: 'stx:libtool' }" |
12 "{ Package: 'stx:libtool' }" |
13 |
13 |
14 View subclass:#MemoryMonitorView |
14 View subclass:#MemoryMonitorView |
15 instanceVariableNames:'updateInterval updateBlock myProcess oldData newData freeData |
15 instanceVariableNames:'updateInterval updateBlock myProcess oldData newData freeData |
16 updateIndex org maxTotal minTotal dX newColor freeColor oldColor |
16 updateIndex org maxTotal minTotal dX newColor freeColor oldColor |
17 prevTotal prevFree prevFree2 prevOld scale drawLock prevMemUsed |
17 prevTotal prevLimit prevFree prevFree2 prevOld scale drawLock |
18 prevCodeUsed prevNumWeak prevNumRem prevNumLifoRem prevTenureAge |
18 prevMemUsed prevCodeUsed prevNumWeak prevNumRem prevNumLifoRem |
19 prevIGCPhase prevLastScavengeReclamation |
19 prevTenureAge prevIGCPhase prevLastScavengeReclamation |
20 prevMinScavengeReclamation prevScavengeCount mallocColor' |
20 prevMinScavengeReclamation prevScavengeCount mallocColor' |
21 classVariableNames:'' |
21 classVariableNames:'' |
22 poolDictionaries:'' |
22 poolDictionaries:'' |
23 category:'Monitors-ST/X' |
23 category:'Monitors-ST/X' |
24 ! |
24 ! |
104 ObjectMemory MemoryMonitor |
104 ObjectMemory MemoryMonitor |
105 MemoryUsageMonitor ProcessMonitor |
105 MemoryUsageMonitor ProcessMonitor |
106 " |
106 " |
107 ! ! |
107 ! ! |
108 |
108 |
|
109 |
109 !MemoryMonitorView methodsFor:'drawing'! |
110 !MemoryMonitorView methodsFor:'drawing'! |
110 |
111 |
111 displayKilo:aNumber name:nm y:y |
112 displayKilo:aNumber name:nm y:y |
112 |s| |
113 |s| |
113 |
114 |
114 aNumber >= (1024*1024*99) ifTrue:[ |
115 aNumber >= (1024*1024*1024*2) ifTrue:[ |
115 s := nm , ((aNumber // (1024*1024)) printStringLeftPaddedTo:5) , 'M '. |
116 s := nm , ((aNumber // (1024*1024*1024)) printStringLeftPaddedTo:5) , 'G '. |
116 ] ifFalse:[ |
117 ] ifFalse:[ |
117 s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '. |
118 aNumber >= (1024*1024*16) ifTrue:[ |
|
119 s := nm , ((aNumber // (1024*1024)) printStringLeftPaddedTo:5) , 'M '. |
|
120 ] ifFalse:[ |
|
121 s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '. |
|
122 ]. |
118 ]. |
123 ]. |
119 self displayOpaqueString:s x:0 y:y. |
124 self displayOpaqueString:s x:0 y:y. |
120 |
125 |
121 "Modified: / 23.9.1998 / 13:19:04 / cg" |
126 "Modified: / 23.9.1998 / 13:19:04 / cg" |
122 ! |
127 ! |
330 |
335 |
331 |oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2 |
336 |oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2 |
332 mallocAllocated mallocTotal |
337 mallocAllocated mallocTotal |
333 codeUsed numWeak numRem numLifoRem tenureAge igcPhase |
338 codeUsed numWeak numRem numLifoRem tenureAge igcPhase |
334 minScavengeReclamation lastScavengeReclamation scavengeCount |
339 minScavengeReclamation lastScavengeReclamation scavengeCount |
335 y half s fontHeight fontDescent total n prevMallocAllocated prevMallocTotal| |
340 y half s fontHeight fontAscent fontDescent |
|
341 limit total n prevMallocAllocated prevMallocTotal| |
336 |
342 |
337 oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed. |
343 oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed. |
338 newMemUsed := ObjectMemory newSpaceUsed. |
344 newMemUsed := ObjectMemory newSpaceUsed. |
339 freeMem := ObjectMemory freeListSpace. |
345 freeMem := ObjectMemory freeListSpace. |
340 oldSpaceSize := ObjectMemory oldSpaceSize + ObjectMemory symSpaceSize. |
346 oldSpaceSize := ObjectMemory oldSpaceSize + ObjectMemory symSpaceSize. |
341 newSpaceSize := ObjectMemory newSpaceSize. |
347 newSpaceSize := ObjectMemory newSpaceSize. |
342 |
348 |
343 mallocAllocated := ObjectMemory mallocAllocated. |
349 mallocAllocated := ObjectMemory mallocAllocated. |
344 mallocTotal := ObjectMemory mallocTotal. |
350 mallocTotal := ObjectMemory mallocTotal. |
|
351 limit := ObjectMemory maxOldSpace. |
345 |
352 |
346 memUsed := oldMemUsed + newMemUsed "- freeMem". |
353 memUsed := oldMemUsed + newMemUsed "- freeMem". |
347 total := oldSpaceSize + newSpaceSize. |
354 total := oldSpaceSize + newSpaceSize. |
348 free2 := ObjectMemory freeSpace. |
355 free2 := ObjectMemory freeSpace. |
349 |
356 |
350 self paint:White on:Black. |
357 self paint:White on:Black. |
351 |
358 |
352 fontDescent := font descent. |
359 fontDescent := font descent. |
|
360 fontAscent := font ascent. |
353 fontHeight := font height + fontDescent. |
361 fontHeight := font height + fontDescent. |
354 half := height // 2 + fontDescent. |
362 half := height // 2 + fontDescent. |
355 |
363 |
356 y := half - (fontHeight * 8). |
364 y := half - (fontHeight * 8). |
357 |
365 |
|
366 limit ~~ prevLimit ifTrue:[ |
|
367 self displayKilo:limit name:'lim ' y:fontAscent. |
|
368 prevLimit := limit. |
|
369 ]. |
358 total ~~ prevTotal ifTrue:[ |
370 total ~~ prevTotal ifTrue:[ |
359 ((total - freeMem) < minTotal) ifTrue:[ |
371 ((total - freeMem) < minTotal) ifTrue:[ |
360 minTotal := total - freeMem. |
372 minTotal := total - freeMem. |
361 ]. |
373 ]. |
362 (total > maxTotal) ifTrue:[ |
374 (total > maxTotal) ifTrue:[ |
363 maxTotal := total. |
375 maxTotal := total. |
364 ]. |
376 ]. |
365 |
377 |
366 self displayKilo:maxTotal name:'max ' y:font ascent. |
378 self displayKilo:maxTotal name:'max ' y:fontAscent + fontHeight. |
367 self displayKilo:minTotal name:'min ' y:(height - font descent). |
379 self displayKilo:minTotal name:'min ' y:(height - fontDescent). |
368 self displayKilo:total name:'tot ' y:y. |
380 self displayKilo:total name:'tot ' y:y. |
369 |
381 |
370 prevTotal := total. |
382 prevTotal := total. |
371 ]. |
383 ]. |
372 |
384 |