MemoryMonitorView.st
branchjv
changeset 12435 1f1faf35be04
parent 12431 9f0c59c742d5
parent 12408 c54a692c5e1f
child 12807 ba8c5416aa28
--- a/MemoryMonitorView.st	Thu Feb 28 22:46:18 2013 +0000
+++ b/MemoryMonitorView.st	Tue Mar 05 18:10:46 2013 +0000
@@ -14,9 +14,9 @@
 View subclass:#MemoryMonitorView
 	instanceVariableNames:'updateInterval updateBlock myProcess oldData newData freeData
 		updateIndex org maxTotal minTotal dX newColor freeColor oldColor
-		prevTotal prevFree prevFree2 prevOld scale drawLock prevMemUsed
-		prevCodeUsed prevNumWeak prevNumRem prevNumLifoRem prevTenureAge
-		prevIGCPhase prevLastScavengeReclamation
+		prevTotal prevLimit prevFree prevFree2 prevOld scale drawLock
+		prevMemUsed prevCodeUsed prevNumWeak prevNumRem prevNumLifoRem
+		prevTenureAge prevIGCPhase prevLastScavengeReclamation
 		prevMinScavengeReclamation prevScavengeCount mallocColor'
 	classVariableNames:''
 	poolDictionaries:''
@@ -106,15 +106,20 @@
 "
 ! !
 
+
 !MemoryMonitorView methodsFor:'drawing'!
 
 displayKilo:aNumber name:nm y:y
     |s|
 
-    aNumber >= (1024*1024*99) ifTrue:[
-        s := nm , ((aNumber // (1024*1024)) printStringLeftPaddedTo:5) , 'M '.
+    aNumber >= (1024*1024*1024*2) ifTrue:[
+        s := nm , ((aNumber // (1024*1024*1024)) printStringLeftPaddedTo:5) , 'G '.
     ] ifFalse:[
-        s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '.
+        aNumber >= (1024*1024*16) ifTrue:[
+            s := nm , ((aNumber // (1024*1024)) printStringLeftPaddedTo:5) , 'M '.
+        ] ifFalse:[
+            s := nm , ((aNumber // 1024) printStringLeftPaddedTo:5) , 'k '.
+        ].
     ].
     self displayOpaqueString:s x:0 y:y.
 
@@ -177,7 +182,7 @@
     x < org ifTrue:[
         "/ force redraw.
 
-        prevFree := prevFree2 := prevOld := prevTotal := nil.
+        prevFree := prevFree2 := prevOld := prevTotal := prevLimit := nil.
         prevMemUsed := prevCodeUsed := prevNumWeak := prevNumRem := nil.
         prevNumLifoRem := prevTenureAge := prevIGCPhase := nil.
         prevLastScavengeReclamation := prevMinScavengeReclamation := nil.
@@ -332,7 +337,8 @@
      mallocAllocated mallocTotal
      codeUsed numWeak numRem numLifoRem tenureAge igcPhase 
      minScavengeReclamation lastScavengeReclamation scavengeCount
-     y half s fontHeight fontDescent total n prevMallocAllocated prevMallocTotal|
+     y half s fontHeight fontAscent fontDescent 
+     limit total n prevMallocAllocated prevMallocTotal|
 
     oldMemUsed := ObjectMemory oldSpaceUsed + ObjectMemory symSpaceUsed.
     newMemUsed := ObjectMemory newSpaceUsed.
@@ -342,6 +348,7 @@
 
     mallocAllocated := ObjectMemory mallocAllocated.
     mallocTotal := ObjectMemory mallocTotal.
+    limit := ObjectMemory maxOldSpace.
 
     memUsed := oldMemUsed + newMemUsed "- freeMem".
     total := oldSpaceSize + newSpaceSize.
@@ -350,11 +357,16 @@
     self paint:White on:Black.
 
     fontDescent := font descent.
+    fontAscent := font ascent.
     fontHeight := font height + fontDescent.
     half := height // 2 + fontDescent.
 
     y := half - (fontHeight * 8).
 
+    limit ~~ prevLimit ifTrue:[
+        self displayKilo:limit    name:'lim ' y:fontAscent.
+        prevLimit := limit.
+    ].
     total ~~ prevTotal ifTrue:[
         ((total - freeMem) < minTotal) ifTrue:[
             minTotal := total - freeMem.
@@ -363,8 +375,8 @@
             maxTotal := total.
         ].
 
-        self displayKilo:maxTotal name:'max ' y:font ascent.
-        self displayKilo:minTotal name:'min ' y:(height - font descent).
+        self displayKilo:maxTotal name:'max ' y:fontAscent + fontHeight.
+        self displayKilo:minTotal name:'min ' y:(height - fontDescent).
         self displayKilo:total    name:'tot ' y:y.
 
         prevTotal := total.
@@ -515,6 +527,7 @@
     "Modified: / 14.7.1998 / 23:35:53 / cg"
 ! !
 
+
 !MemoryMonitorView methodsFor:'events'!
 
 keyPress:key x:x y:y
@@ -580,6 +593,7 @@
     "Modified: / 7.9.1998 / 21:41:13 / cg"
 ! !
 
+
 !MemoryMonitorView methodsFor:'initialization & release'!
 
 destroy
@@ -677,6 +691,7 @@
     "Created: / 15.9.1998 / 15:22:46 / cg"
 ! !
 
+
 !MemoryMonitorView methodsFor:'menu functions'!
 
 backgroundCollect
@@ -1006,6 +1021,7 @@
     "Modified: 27.6.1997 / 14:22:47 / cg"
 ! !
 
+
 !MemoryMonitorView methodsFor:'private'!
 
 updateProcess
@@ -1017,14 +1033,15 @@
     "Modified: / 23.9.1998 / 12:40:31 / cg"
 ! !
 
+
 !MemoryMonitorView class methodsFor:'documentation'!
 
 version
-    ^ '$Id: MemoryMonitorView.st 7854 2012-01-30 17:49:41Z vranyj1 $'
+    ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitorView.st,v 1.18 2013-02-20 09:53:50 cg Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libtool/MemoryMonitorView.st,v 1.16 2011/08/16 13:13:38 stefan Exp §'
+    ^ '$Header: /cvs/stx/stx/libtool/MemoryMonitorView.st,v 1.18 2013-02-20 09:53:50 cg Exp $'
 !
 
 version_HG