--- a/MemoryMonitor.st Fri Jul 10 18:24:07 1998 +0200
+++ b/MemoryMonitor.st Wed Jul 15 13:01:02 1998 +0200
@@ -13,7 +13,10 @@
StandardSystemView subclass:#MemoryMonitor
instanceVariableNames:'updateInterval updateBlock myProcess oldData newData freeData
updateIndex org maxTotal minTotal dX newColor freeColor oldColor
- prevTotal prevFree prevFree2 prevOld scale drawLock'
+ prevTotal prevFree prevFree2 prevOld scale drawLock prevMemUsed
+ prevCodeUsed prevNumWeak prevNumRem prevNumLifoRem prevTenureAge
+ prevIGCPhase prevLastScavengeReclamation
+ prevMinScavengeReclamation prevScavengeCount'
classVariableNames:''
poolDictionaries:''
category:'Monitors-ST/X'
@@ -113,6 +116,17 @@
^ 'Memory Monitor'
! !
+!MemoryMonitor class methodsFor:'startup'!
+
+isVisualStartable
+ "returns whether this application class can be started via #open
+ (i.e. via a double click on the class in the browser)"
+
+ ^ true
+
+ "Created: / 15.7.1998 / 12:59:58 / cg"
+! !
+
!MemoryMonitor methodsFor:'destroying'!
destroy
@@ -153,47 +167,55 @@
right := x + w - 1.
right >= org ifTrue:[
- lx := x.
- lx < org ifTrue:[
- lx := org
- ].
+ lx := x.
+ lx < org ifTrue:[
+ lx := org
+ ].
- total := ObjectMemory symSpaceSize
- + ObjectMemory oldSpaceSize
- + ObjectMemory newSpaceSize.
+ total := ObjectMemory symSpaceSize
+ + ObjectMemory oldSpaceSize
+ + ObjectMemory newSpaceSize.
- startIdx := (lx-org+1).
- startIdx < 1 ifTrue:[
- startIdx := 1
- ].
+ startIdx := (lx-org+1).
+ startIdx < 1 ifTrue:[
+ startIdx := 1
+ ].
- endIdx := right-org+1.
- endIdx >= updateIndex ifTrue:[
- endIdx := updateIndex-1.
- ].
- dX := 0.
+ endIdx := right-org+1.
+ endIdx >= updateIndex ifTrue:[
+ endIdx := updateIndex-1.
+ ].
+ dX := 0.
- startIdx to:endIdx do:[:i |
- newSpaceUsed := newData at:i.
- newSpaceUsed notNil ifTrue:[
- oldSpaceUsed := oldData at:i.
- freeMem := freeData at:i.
+ startIdx to:endIdx do:[:i |
+ newSpaceUsed := newData at:i.
+ newSpaceUsed notNil ifTrue:[
+ oldSpaceUsed := oldData at:i.
+ freeMem := freeData at:i.
- self updateLineX:lx - dX
- total:total
- old:oldSpaceUsed
- new:newSpaceUsed
- free:freeMem.
- ].
- lx := lx + 1
- ]
+ self updateLineX:lx - dX
+ total:total
+ old:oldSpaceUsed
+ new:newSpaceUsed
+ free:freeMem.
+ ].
+ lx := lx + 1
+ ]
].
x < org ifTrue:[
- prevFree := prevFree2 := prevOld := prevTotal := nil.
+ "/ force redraw.
- self updateNumbers.
+ prevFree := prevFree2 := prevOld := prevTotal := nil.
+ prevMemUsed := prevCodeUsed := prevNumWeak := prevNumRem := nil.
+ prevNumLifoRem := prevTenureAge := prevIGCPhase := nil.
+ prevLastScavengeReclamation := prevMinScavengeReclamation := nil.
+ prevScavengeCount := nil.
+
+ self updateNumbers.
]
+
+ "Modified: / 14.7.1998 / 23:33:47 / cg"
!
updateDisplay
@@ -323,7 +345,9 @@
"
|oldSpaceSize newSpaceSize memUsed oldMemUsed newMemUsed freeMem free2
- y half s fontHeight total n|
+ codeUsed numWeak numRem numLifoRem tenureAge igcPhase
+ minScavengeReclamation lastScavengeReclamation scavengeCount
+ y half s fontHeight fontDescent total n|
oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
newMemUsed := ObjectMemory newSpaceUsed.
@@ -337,8 +361,9 @@
self paint:White on:Black.
- fontHeight := font height + font descent.
- half := height // 2 + font descent.
+ fontDescent := font descent.
+ fontHeight := font height + fontDescent.
+ half := height // 2 + fontDescent.
y := half - (fontHeight * 5).
@@ -358,7 +383,10 @@
].
y := y + fontHeight.
- self displayKilo:memUsed name:'all ' y:y.
+ memUsed ~~ prevMemUsed ifTrue:[
+ self displayKilo:memUsed name:'all ' y:y.
+ prevMemUsed := memUsed.
+ ].
y := y + fontHeight.
self paint:newColor.
@@ -385,38 +413,63 @@
prevOld := (oldMemUsed - freeMem).
].
+ y := y + fontHeight.
ObjectMemory supportsJustInTimeCompilation ifTrue:[
- y := y + fontHeight.
- self paint:oldColor.
- n := ObjectMemory compiledCodeSpaceUsed.
- n > 9999 ifTrue:[
- s := 'code ' , ((n // 1024) printStringLeftPaddedTo:4) , 'k'.
- ] ifFalse:[
- s := 'code ' , (n printStringLeftPaddedTo:4) , ' '.
- ].
- self displayOpaqueString:s x:0 y:y.
+ codeUsed := ObjectMemory compiledCodeSpaceUsed.
+ prevCodeUsed ~~ codeUsed ifTrue:[
+ self paint:oldColor.
+ codeUsed > 9999 ifTrue:[
+ s := 'code ' , ((codeUsed // 1024) printStringLeftPaddedTo:4) , 'k'.
+ ] ifFalse:[
+ s := 'code ' , (codeUsed printStringLeftPaddedTo:4) , ' '.
+ ].
+ self displayOpaqueString:s x:0 y:y.
+ prevCodeUsed := codeUsed.
+ ]
].
"
the following is internal - normally only interesting when debugging the VM
"
y := y + fontHeight.
- self paint:oldColor.
- s := 't:' , (ObjectMemory tenureAge printStringLeftPaddedTo:2) , ' '.
- s := s , ' I:' , (ObjectMemory incrementalGCPhase printStringLeftPaddedTo:2) , ' '.
- self displayOpaqueString:s x:0 y:y.
+ tenureAge := ObjectMemory tenureAge.
+ igcPhase := ObjectMemory incrementalGCPhase.
+ (prevTenureAge ~~ tenureAge
+ or:[prevIGCPhase ~~ igcPhase]) ifTrue:[
+ self paint:oldColor.
+ s := 't:' , (tenureAge printStringLeftPaddedTo:2) , ' '.
+ s := s , ' I:' , (igcPhase printStringLeftPaddedTo:2) , ' '.
+ self displayOpaqueString:s x:0 y:y.
+ prevTenureAge := tenureAge.
+ prevIGCPhase := igcPhase.
+ ].
y := y + fontHeight.
- s := 'weak: ' , (ObjectMemory numberOfWeakObjects printStringLeftPaddedTo:4).
- self displayOpaqueString:s x:0 y:y.
+ numWeak := ObjectMemory numberOfWeakObjects.
+ prevNumWeak ~~ numWeak ifTrue:[
+ self paint:oldColor.
+ s := 'weak: ' , (numWeak printStringLeftPaddedTo:4).
+ self displayOpaqueString:s x:0 y:y.
+ prevNumWeak := numWeak.
+ ].
y := y + fontHeight.
- s := 'rem: ' , (ObjectMemory rememberedSetSize printStringLeftPaddedTo:5).
- self displayOpaqueString:s x:0 y:y.
+ numRem := ObjectMemory rememberedSetSize.
+ prevNumRem ~~ numRem ifTrue:[
+ self paint:oldColor.
+ s := 'rem: ' , (numRem printStringLeftPaddedTo:5).
+ self displayOpaqueString:s x:0 y:y.
+ prevNumRem := numRem.
+ ].
y := y + fontHeight.
- s := 'lrem: ' , (ObjectMemory lifoRememberedSetSize printStringLeftPaddedTo:4 ifLarger:['****']).
- self displayOpaqueString:s x:0 y:y.
+ numLifoRem := ObjectMemory lifoRememberedSetSize.
+ prevNumLifoRem ~~ numLifoRem ifTrue:[
+ self paint:oldColor.
+ s := 'lrem: ' , (numLifoRem printStringLeftPaddedTo:4 ifLarger:['****']).
+ self displayOpaqueString:s x:0 y:y.
+ prevNumLifoRem := numLifoRem.
+ ].
"/ does no longer make sense to show ....
"/ y := y + fontHeight.
@@ -425,10 +478,14 @@
"/ ].
y := y + fontHeight.
- n := ObjectMemory minScavengeReclamation / ObjectMemory newSpaceSize * 100.0.
- n := 100 - n asInteger.
- s := 'minSc ', (n printStringLeftPaddedTo:3) , '%'.
- self displayOpaqueString:s x:0 y:y.
+ minScavengeReclamation := ObjectMemory minScavengeReclamation * 100 // ObjectMemory newSpaceSize.
+ prevMinScavengeReclamation ~~ minScavengeReclamation ifTrue:[
+ minScavengeReclamation := 100 - minScavengeReclamation asInteger.
+ s := 'minSc ', (minScavengeReclamation printStringLeftPaddedTo:3) , '%'.
+ self paint:oldColor.
+ self displayOpaqueString:s x:0 y:y.
+ prevMinScavengeReclamation := minScavengeReclamation.
+ ].
y := y + fontHeight.
n := ObjectMemory maxInterruptLatency.
@@ -440,14 +497,20 @@
self displayOpaqueString:s x:0 y:y.
y := y + fontHeight.
- n := ObjectMemory lastScavengeReclamation / ObjectMemory newSpaceSize * 100.0.
- n := 100 - n asInteger.
- s := (ObjectMemory scavengeCount printStringLeftPaddedTo:6)
- , (n printStringLeftPaddedTo:3) , '%'.
- self displayOpaqueString:s x:0 y:y.
+ scavengeCount := ObjectMemory scavengeCount.
+ lastScavengeReclamation := ObjectMemory lastScavengeReclamation * 100 // ObjectMemory newSpaceSize.
+ (prevScavengeCount ~~ scavengeCount
+ or:[prevLastScavengeReclamation ~~ lastScavengeReclamation]) ifTrue:[
+ lastScavengeReclamation := 100 - lastScavengeReclamation asInteger.
+ s := (scavengeCount printStringLeftPaddedTo:6)
+ , (lastScavengeReclamation printStringLeftPaddedTo:3) , '%'.
+ self displayOpaqueString:s x:0 y:y.
+ prevLastScavengeReclamation := lastScavengeReclamation.
+ prevScavengeCount := scavengeCount.
+ ].
- "Created: 7.11.1995 / 14:48:16 / cg"
- "Modified: 24.8.1996 / 11:57:22 / cg"
+ "Created: / 7.11.1995 / 14:48:16 / cg"
+ "Modified: / 14.7.1998 / 23:35:53 / cg"
! !
!MemoryMonitor methodsFor:'events'!
@@ -836,5 +899,5 @@
!MemoryMonitor class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.49 1998-04-25 23:09:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitor.st,v 1.50 1998-07-15 11:01:02 cg Exp $'
! !