MemoryUsageView.st
branchjv
changeset 13173 e9da2324940d
parent 12650 e0f607754b9a
parent 12892 1215124609dc
child 13178 c9bf900fe729
--- a/MemoryUsageView.st	Thu Jun 13 12:23:07 2013 +0100
+++ b/MemoryUsageView.st	Fri Jun 21 19:05:40 2013 +0100
@@ -748,6 +748,8 @@
 
     |nameLen countLen bytesUsedSize avgSizeLen maxSizeLen accumMemoryUseLen|
 
+    rawInfo isNil ifTrue:[^ self].
+
     nameLen := 50.
     countLen := 7.
     bytesUsedSize := 10.
@@ -787,7 +789,7 @@
 
         l := OrderedCollection new.
         info doWithIndex:[:entry :i |
-            |line avgSz avgSzString maxSz instCount percent|
+            |line avgSz avgSzString maxSz instCount percent allocRate memRate s1 s2|
 
             maxSz := entry maxByteSize.
             avgSz := entry averageSize asFixedPoint:1.
@@ -811,8 +813,21 @@
             lastP := sumPercent := ((sumPercent + percent) min:100.0).
             line := line , ((sumPercent asFixedPoint:1) printStringLeftPaddedTo:accumMemoryUseLen).
 
-            line := line , (entry instanceAllocationRate printStringLeftPaddedTo:countLen).
-            line := line , (entry memoryAllocationRate printStringLeftPaddedTo:bytesUsedSize).
+            allocRate := entry instanceAllocationRate.
+            memRate := entry memoryAllocationRate.
+            s1 := allocRate printString.
+            s2 := memRate printString.
+            allocRate > 0 ifTrue:[
+                s1 := s1 colorizeAllWith:(Color red).
+                s2 := s2 colorizeAllWith:(Color red).
+            ] ifFalse:[
+                allocRate < 0 ifTrue:[
+                    s1 := s1 colorizeAllWith:(Color green darkened).
+                    s2 := s2 colorizeAllWith:(Color green darkened).
+                ]
+            ].
+            line := line , (s1 leftPaddedTo:countLen).
+            line := line , (s2 leftPaddedTo:bytesUsedSize).
 
             l add:line.
 
@@ -939,7 +954,11 @@
     super realize.
     titleLabel origin:(list originRelativeTo:self) x @ 0.0.
     self updateInfo.
-    self sortByClass.
+
+    "/ self sortByClass.
+    self sortByMemoryUsage.
+
+    "/ self updateDisplay.
 
     "Modified: 14.10.1997 / 21:03:52 / cg"
 ! !
@@ -1050,11 +1069,11 @@
 !MemoryUsageView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.61 2012-11-04 22:12:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.63 2013-06-13 14:14:27 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.61 2012-11-04 22:12:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/MemoryUsageView.st,v 1.63 2013-06-13 14:14:27 cg Exp $'
 !
 
 version_HG