Add memory usage counting in method ctrl/menu.
authorStefan Vogel <sv@exept.de>
Tue, 19 Dec 1995 10:54:17 +0100
changeset 312 88a6d2b2f1fb
parent 311 c118ce1f8afd
child 313 c143d37be2e9
Add memory usage counting in method ctrl/menu.
BrowserView.st
BrwsrView.st
--- a/BrowserView.st	Mon Dec 18 15:23:08 1995 +0100
+++ b/BrowserView.st	Tue Dec 19 10:54:17 1995 +0100
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.8 on 18-dec-1995 at 22:59:28'                   !
+
 StandardSystemView subclass:#BrowserView
 	instanceVariableNames:'classCategoryListView classListView methodCategoryListView
 		methodListView classMethodListView codeView classToggle
@@ -4380,7 +4382,7 @@
      localSearchLabels localSearchSelectors|
 
     device ctrlDown ifTrue:[
-        "/ 'secret' developpers menu
+        "/ 'secret' developers menu
 
         currentMethod isNil ifTrue:[
             methodListView flash.
@@ -4388,26 +4390,38 @@
         ].
 
         currentMethod isWrapped ifTrue:[
-            (MessageTracer isCounting:currentMethod) ifTrue:[
+            (MessageTracer isCountingMemoryUsage:currentMethod) ifTrue:[
                 brkLabels := #(
                                     '-'
-                                    'stop counting' 
+                                    'stop mem usage' 
                               ).
 
                 brkSelectors := #(
                                     nil
-                                    methodStopCounting
+                                    methodStopMemoryUsage
                                  )
             ] ifFalse:[
-                brkLabels := #(
-                                    '-'
-                                    'remove break/trace' 
-                              ).
-
-                brkSelectors := #(
-                                    nil
-                                    methodRemoveBreakOrTrace
-                                 )
+                (MessageTracer isCounting:currentMethod) ifTrue:[
+                    brkLabels := #(
+                                        '-'
+                                        'stop counting' 
+                                  ).
+
+                    brkSelectors := #(
+                                        nil
+                                        methodStopCounting
+                                     )
+                ] ifFalse:[
+                    brkLabels := #(
+                                        '-'
+                                        'remove break/trace' 
+                                  ).
+
+                    brkSelectors := #(
+                                        nil
+                                        methodRemoveBreakOrTrace
+                                     )
+                ]
             ]
         ] ifFalse:[
             brkLabels := #(
@@ -4416,7 +4430,8 @@
                                 'trace' 
                                 'trace sender' 
                                 'trace full walkback' 
-                                'start counting' 
+                                'start counting'
+                                'start mem usage'
                           ).
 
             brkSelectors := #(
@@ -4426,6 +4441,7 @@
                                 methodTraceSender
                                 methodTraceFull
                                 methodStartCounting
+                                methodStartMemoryUsage
                              )
         ].
 
@@ -4604,6 +4620,7 @@
 
     "Created: 23.11.1995 / 12:02:29 / cg"
     "Modified: 15.12.1995 / 21:56:56 / cg"
+    "Modified: 18.12.1995 / 16:20:07 / stefan"
 !
 
 methodMove
@@ -4804,6 +4821,14 @@
     "Created: 15.12.1995 / 11:00:44 / cg"
 !
 
+methodStartMemoryUsage
+    "set a countpoint for memory usage on the current method"
+
+    self commonTraceHelperWith:#countMemoryUsageOfMethod:
+
+    "Created: 18.12.1995 / 16:00:22 / stefan"
+!
+
 methodStopCounting
     "show the number of invocations & remove a countpoint on the current method"
 
@@ -4814,6 +4839,15 @@
     "Modified: 15.12.1995 / 17:13:05 / cg"
 !
 
+methodStopMemoryUsage
+    "stop counting of memory usage for this method"
+
+"/    self information:'called ' , (MessageTracer executionCountOfMethod:currentMethod) printString , ' times.'.
+    self commonTraceHelperWith:#stopCountingMemoryUsageOfMethod:
+
+    "Created: 18.12.1995 / 16:02:02 / stefan"
+!
+
 methodStringSearch
     "launch an enterBox for string to search for"
 
@@ -4916,7 +4950,13 @@
 "/                            moreInfo := (String new:(24 - sel size) withAll:$ )
 "/                        ]
 "/                    ].
-                    moreInfo := moreInfo , '    (called ' , (MessageTracer executionCountOfMethod:aMethod) printString , ' times)'.
+                    (MessageTracer isCountingMemoryUsage:aMethod) ifTrue:[
+                        moreInfo := moreInfo , 
+                             '    (mem usage ' , (MessageTracer memoryUsageOfMethod:aMethod) printString , ' Bytes)'.
+                    ] ifFalse:[
+                        moreInfo := moreInfo , 
+                             '    (called ' , (MessageTracer executionCountOfMethod:aMethod) printString , ' times)'.
+                    ]
                 ] ifFalse:[
                     moreInfo := ' !!'
                 ]
@@ -4942,6 +4982,7 @@
 
     "Modified: 28.8.1995 / 21:53:34 / claus"
     "Modified: 15.12.1995 / 17:13:59 / cg"
+    "Modified: 18.12.1995 / 16:18:39 / stefan"
 !
 
 methodSelection:lineNr
@@ -5144,36 +5185,38 @@
 
 
     methodListView notNil ifTrue:[
-	selection := methodListView selection.
-
-	currentMethodCategory notNil ifTrue:[
-	    fullProtocol ifTrue:[
-		selectors := self listOfAllSelectorsInCategory:currentMethodCategory 
-					    inFullProtocolHierarchyOfClass:actualClass
-	    ] ifFalse:[
-		selectors := self listOfAllSelectorsInCategory:currentMethodCategory
-						       ofClass:actualClass
-	    ]
-	].
-	scr := scroll.
-	first := methodListView firstLineShown.
-	first ~~ 1 ifTrue:[
-	    last := methodListView lastLineShown.
-	    selectors size <= (last - first + 1) ifTrue:[
-		scr := true
-	    ]
-	].
-	methodListView list = selectors ifFalse:[
-	    scr ifTrue:[
-		methodListView contents:selectors
-	    ] ifFalse:[
-		methodListView setContents:selectors
-	    ]
-	].
-	keep ifTrue:[
-	    methodListView selection:selection.
-	]
+        selection := methodListView selection.
+
+        currentMethodCategory notNil ifTrue:[
+            fullProtocol ifTrue:[
+                selectors := self listOfAllSelectorsInCategory:currentMethodCategory 
+                                            inFullProtocolHierarchyOfClass:actualClass
+            ] ifFalse:[
+                selectors := self listOfAllSelectorsInCategory:currentMethodCategory
+                                                       ofClass:actualClass
+            ]
+        ].
+        scr := scroll.
+        first := methodListView firstLineShown.
+        first ~~ 1 ifTrue:[
+            last := methodListView lastLineShown.
+            selectors size <= (last - first + 1) ifTrue:[
+                scr := true
+            ]
+        ].
+        methodListView list = selectors ifFalse:[
+            scr ifTrue:[
+                methodListView contents:selectors
+            ] ifFalse:[
+                methodListView setContents:selectors
+            ]
+        ].
+        keep ifTrue:[
+            methodListView selection:selection.
+        ]
     ]
+
+    "Modified: 18.12.1995 / 22:54:04 / stefan"
 ! !
 
 !BrowserView methodsFor:'misc'!
@@ -6460,6 +6503,6 @@
 !BrowserView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.80 1995-12-16 17:46:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.81 1995-12-19 09:54:17 stefan Exp $'
 ! !
 BrowserView initialize!
--- a/BrwsrView.st	Mon Dec 18 15:23:08 1995 +0100
+++ b/BrwsrView.st	Tue Dec 19 10:54:17 1995 +0100
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.8 on 18-dec-1995 at 22:59:28'                   !
+
 StandardSystemView subclass:#BrowserView
 	instanceVariableNames:'classCategoryListView classListView methodCategoryListView
 		methodListView classMethodListView codeView classToggle
@@ -4380,7 +4382,7 @@
      localSearchLabels localSearchSelectors|
 
     device ctrlDown ifTrue:[
-        "/ 'secret' developpers menu
+        "/ 'secret' developers menu
 
         currentMethod isNil ifTrue:[
             methodListView flash.
@@ -4388,26 +4390,38 @@
         ].
 
         currentMethod isWrapped ifTrue:[
-            (MessageTracer isCounting:currentMethod) ifTrue:[
+            (MessageTracer isCountingMemoryUsage:currentMethod) ifTrue:[
                 brkLabels := #(
                                     '-'
-                                    'stop counting' 
+                                    'stop mem usage' 
                               ).
 
                 brkSelectors := #(
                                     nil
-                                    methodStopCounting
+                                    methodStopMemoryUsage
                                  )
             ] ifFalse:[
-                brkLabels := #(
-                                    '-'
-                                    'remove break/trace' 
-                              ).
-
-                brkSelectors := #(
-                                    nil
-                                    methodRemoveBreakOrTrace
-                                 )
+                (MessageTracer isCounting:currentMethod) ifTrue:[
+                    brkLabels := #(
+                                        '-'
+                                        'stop counting' 
+                                  ).
+
+                    brkSelectors := #(
+                                        nil
+                                        methodStopCounting
+                                     )
+                ] ifFalse:[
+                    brkLabels := #(
+                                        '-'
+                                        'remove break/trace' 
+                                  ).
+
+                    brkSelectors := #(
+                                        nil
+                                        methodRemoveBreakOrTrace
+                                     )
+                ]
             ]
         ] ifFalse:[
             brkLabels := #(
@@ -4416,7 +4430,8 @@
                                 'trace' 
                                 'trace sender' 
                                 'trace full walkback' 
-                                'start counting' 
+                                'start counting'
+                                'start mem usage'
                           ).
 
             brkSelectors := #(
@@ -4426,6 +4441,7 @@
                                 methodTraceSender
                                 methodTraceFull
                                 methodStartCounting
+                                methodStartMemoryUsage
                              )
         ].
 
@@ -4604,6 +4620,7 @@
 
     "Created: 23.11.1995 / 12:02:29 / cg"
     "Modified: 15.12.1995 / 21:56:56 / cg"
+    "Modified: 18.12.1995 / 16:20:07 / stefan"
 !
 
 methodMove
@@ -4804,6 +4821,14 @@
     "Created: 15.12.1995 / 11:00:44 / cg"
 !
 
+methodStartMemoryUsage
+    "set a countpoint for memory usage on the current method"
+
+    self commonTraceHelperWith:#countMemoryUsageOfMethod:
+
+    "Created: 18.12.1995 / 16:00:22 / stefan"
+!
+
 methodStopCounting
     "show the number of invocations & remove a countpoint on the current method"
 
@@ -4814,6 +4839,15 @@
     "Modified: 15.12.1995 / 17:13:05 / cg"
 !
 
+methodStopMemoryUsage
+    "stop counting of memory usage for this method"
+
+"/    self information:'called ' , (MessageTracer executionCountOfMethod:currentMethod) printString , ' times.'.
+    self commonTraceHelperWith:#stopCountingMemoryUsageOfMethod:
+
+    "Created: 18.12.1995 / 16:02:02 / stefan"
+!
+
 methodStringSearch
     "launch an enterBox for string to search for"
 
@@ -4916,7 +4950,13 @@
 "/                            moreInfo := (String new:(24 - sel size) withAll:$ )
 "/                        ]
 "/                    ].
-                    moreInfo := moreInfo , '    (called ' , (MessageTracer executionCountOfMethod:aMethod) printString , ' times)'.
+                    (MessageTracer isCountingMemoryUsage:aMethod) ifTrue:[
+                        moreInfo := moreInfo , 
+                             '    (mem usage ' , (MessageTracer memoryUsageOfMethod:aMethod) printString , ' Bytes)'.
+                    ] ifFalse:[
+                        moreInfo := moreInfo , 
+                             '    (called ' , (MessageTracer executionCountOfMethod:aMethod) printString , ' times)'.
+                    ]
                 ] ifFalse:[
                     moreInfo := ' !!'
                 ]
@@ -4942,6 +4982,7 @@
 
     "Modified: 28.8.1995 / 21:53:34 / claus"
     "Modified: 15.12.1995 / 17:13:59 / cg"
+    "Modified: 18.12.1995 / 16:18:39 / stefan"
 !
 
 methodSelection:lineNr
@@ -5144,36 +5185,38 @@
 
 
     methodListView notNil ifTrue:[
-	selection := methodListView selection.
-
-	currentMethodCategory notNil ifTrue:[
-	    fullProtocol ifTrue:[
-		selectors := self listOfAllSelectorsInCategory:currentMethodCategory 
-					    inFullProtocolHierarchyOfClass:actualClass
-	    ] ifFalse:[
-		selectors := self listOfAllSelectorsInCategory:currentMethodCategory
-						       ofClass:actualClass
-	    ]
-	].
-	scr := scroll.
-	first := methodListView firstLineShown.
-	first ~~ 1 ifTrue:[
-	    last := methodListView lastLineShown.
-	    selectors size <= (last - first + 1) ifTrue:[
-		scr := true
-	    ]
-	].
-	methodListView list = selectors ifFalse:[
-	    scr ifTrue:[
-		methodListView contents:selectors
-	    ] ifFalse:[
-		methodListView setContents:selectors
-	    ]
-	].
-	keep ifTrue:[
-	    methodListView selection:selection.
-	]
+        selection := methodListView selection.
+
+        currentMethodCategory notNil ifTrue:[
+            fullProtocol ifTrue:[
+                selectors := self listOfAllSelectorsInCategory:currentMethodCategory 
+                                            inFullProtocolHierarchyOfClass:actualClass
+            ] ifFalse:[
+                selectors := self listOfAllSelectorsInCategory:currentMethodCategory
+                                                       ofClass:actualClass
+            ]
+        ].
+        scr := scroll.
+        first := methodListView firstLineShown.
+        first ~~ 1 ifTrue:[
+            last := methodListView lastLineShown.
+            selectors size <= (last - first + 1) ifTrue:[
+                scr := true
+            ]
+        ].
+        methodListView list = selectors ifFalse:[
+            scr ifTrue:[
+                methodListView contents:selectors
+            ] ifFalse:[
+                methodListView setContents:selectors
+            ]
+        ].
+        keep ifTrue:[
+            methodListView selection:selection.
+        ]
     ]
+
+    "Modified: 18.12.1995 / 22:54:04 / stefan"
 ! !
 
 !BrowserView methodsFor:'misc'!
@@ -6460,6 +6503,6 @@
 !BrowserView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/BrwsrView.st,v 1.80 1995-12-16 17:46:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/BrwsrView.st,v 1.81 1995-12-19 09:54:17 stefan Exp $'
 ! !
 BrowserView initialize!