--- a/MessageTracer.st Mon Jun 17 17:19:09 1996 +0200
+++ b/MessageTracer.st Mon Jun 17 17:21:20 1996 +0200
@@ -680,35 +680,6 @@
"Modified: 15.12.1995 / 15:45:15 / cg"
!
-executionTimesOfMethod:aMethod
- "return the current times"
-
- |count info min max avg ret|
-
- count := min := max := avg := 0.
- MethodTiming notNil ifTrue:[
- aMethod isWrapped ifTrue:[
- info := MethodTiming at:aMethod originalMethod ifAbsent:nil.
- info notNil ifTrue:[
- count := info at:1.
- min := info at:2.
- max := info at:3.
- avg := ((info at:4) / count) roundTo:0.01
- ].
- ].
- ].
-
- ret := IdentityDictionary new.
- ret at:#count put:count.
- ret at:#minTime put:min.
- ret at:#maxTime put:max.
- ret at:#avgTime put:avg.
- ^ ret
-
- "Created: 17.6.1996 / 17:07:30 / cg"
- "Modified: 17.6.1996 / 17:08:24 / cg"
-!
-
isCounting:aMethod
"return true if aMethod is counted"
@@ -723,90 +694,12 @@
"Modified: 15.12.1995 / 15:42:10 / cg"
!
-isTiming:aMethod
- "return true if aMethod is timed"
-
- MethodTiming isNil ifTrue:[^ false].
- (MethodTiming includesKey:aMethod) ifTrue:[^ true].
- aMethod isWrapped ifTrue:[
- ^ MethodTiming includesKey:aMethod originalMethod
- ].
- ^ false
-
- "Modified: 15.12.1995 / 15:42:10 / cg"
- "Created: 17.6.1996 / 17:04:29 / cg"
-!
-
stopCountingMethod:aMethod
"remove counting of aMethod"
^ self unwrapMethod:aMethod
"Modified: 15.12.1995 / 15:43:53 / cg"
-!
-
-stopTimingMethod:aMethod
- "remove timing of aMethod"
-
- ^ self unwrapMethod:aMethod
-
- "Modified: 15.12.1995 / 15:43:53 / cg"
- "Created: 17.6.1996 / 17:04:03 / cg"
-!
-
-timeMethod:aMethod
- "arrange for a aMethods execution time to be measured.
- Use unwrapMethod to remove this."
-
- |lvl inside t0|
-
- MethodTiming isNil ifTrue:[
- MethodTiming := IdentityDictionary new.
- ].
- MethodTiming removeKey:aMethod ifAbsent:nil.
-
- ^ self wrapMethod:aMethod
- onEntry:[:con |
- t0 := OperatingSystem getMillisecondTime.
- ]
- onExit:[:con :retVal |
- |info t cnt min max sumTimes|
-
- t := OperatingSystem getMillisecondTime - t0.
- info := MethodTiming at:aMethod ifAbsent:nil.
- info isNil ifTrue:[
- MethodTiming at:aMethod put:(Array with:1
- with:t
- with:t
- with:t)
- ] ifFalse:[
- cnt := info at:1.
- min := info at:2.
- max := info at:3.
- sumTimes := info at:4.
- t < min ifTrue:[
- info at:2 put:t
- ] ifFalse:[
- t > max ifTrue:[
- info at:3 put:t
- ]
- ].
- info at:4 put:(sumTimes + t).
- info at:1 put:cnt + 1
- ].
- ]
-
- "
- MessageTracer timeMethod:(Integer compiledMethodAt:#factorial).
- 5 factorial.
- 5 factorial.
- 5 factorial.
- (MessageTracer executionTimesOfMethod:(Integer compiledMethodAt:#factorial)) printCR.
- MessageTracer stopTimingMethod:(Integer compiledMethodAt:#factorial)
- "
-
- "Created: 17.6.1996 / 17:03:50 / cg"
- "Modified: 17.6.1996 / 17:10:43 / cg"
! !
!MessageTracer class methodsFor:'method memory usage'!
@@ -910,6 +803,115 @@
"Modified: 18.12.1995 / 21:54:36 / stefan"
! !
+!MessageTracer class methodsFor:'method timing'!
+
+executionTimesOfMethod:aMethod
+ "return the current times"
+
+ |count info min max avg ret|
+
+ count := min := max := avg := 0.
+ MethodTiming notNil ifTrue:[
+ aMethod isWrapped ifTrue:[
+ info := MethodTiming at:aMethod originalMethod ifAbsent:nil.
+ info notNil ifTrue:[
+ count := info at:1.
+ min := info at:2.
+ max := info at:3.
+ avg := ((info at:4) / count) roundTo:0.01
+ ].
+ ].
+ ].
+
+ ret := IdentityDictionary new.
+ ret at:#count put:count.
+ ret at:#minTime put:min.
+ ret at:#maxTime put:max.
+ ret at:#avgTime put:avg.
+ ^ ret
+
+ "Created: 17.6.1996 / 17:07:30 / cg"
+ "Modified: 17.6.1996 / 17:08:24 / cg"
+!
+
+isTiming:aMethod
+ "return true if aMethod is timed"
+
+ MethodTiming isNil ifTrue:[^ false].
+ (MethodTiming includesKey:aMethod) ifTrue:[^ true].
+ aMethod isWrapped ifTrue:[
+ ^ MethodTiming includesKey:aMethod originalMethod
+ ].
+ ^ false
+
+ "Modified: 15.12.1995 / 15:42:10 / cg"
+ "Created: 17.6.1996 / 17:04:29 / cg"
+!
+
+stopTimingMethod:aMethod
+ "remove timing of aMethod"
+
+ ^ self unwrapMethod:aMethod
+
+ "Modified: 15.12.1995 / 15:43:53 / cg"
+ "Created: 17.6.1996 / 17:04:03 / cg"
+!
+
+timeMethod:aMethod
+ "arrange for a aMethods execution time to be measured.
+ Use unwrapMethod to remove this."
+
+ |lvl inside t0|
+
+ MethodTiming isNil ifTrue:[
+ MethodTiming := IdentityDictionary new.
+ ].
+ MethodTiming removeKey:aMethod ifAbsent:nil.
+
+ ^ self wrapMethod:aMethod
+ onEntry:[:con |
+ t0 := OperatingSystem getMillisecondTime.
+ ]
+ onExit:[:con :retVal |
+ |info t cnt min max sumTimes|
+
+ t := OperatingSystem getMillisecondTime - t0.
+ info := MethodTiming at:aMethod ifAbsent:nil.
+ info isNil ifTrue:[
+ MethodTiming at:aMethod put:(Array with:1
+ with:t
+ with:t
+ with:t)
+ ] ifFalse:[
+ cnt := info at:1.
+ min := info at:2.
+ max := info at:3.
+ sumTimes := info at:4.
+ t < min ifTrue:[
+ info at:2 put:t
+ ] ifFalse:[
+ t > max ifTrue:[
+ info at:3 put:t
+ ]
+ ].
+ info at:4 put:(sumTimes + t).
+ info at:1 put:cnt + 1
+ ].
+ ]
+
+ "
+ MessageTracer timeMethod:(Integer compiledMethodAt:#factorial).
+ 5 factorial.
+ 5 factorial.
+ 5 factorial.
+ (MessageTracer executionTimesOfMethod:(Integer compiledMethodAt:#factorial)) printCR.
+ MessageTracer stopTimingMethod:(Integer compiledMethodAt:#factorial)
+ "
+
+ "Created: 17.6.1996 / 17:03:50 / cg"
+ "Modified: 17.6.1996 / 17:10:43 / cg"
+! !
+
!MessageTracer class methodsFor:'method tracing'!
traceMethod:aMethod
@@ -1039,6 +1041,13 @@
MethodMemoryUsage removeKey:aMethod ifAbsent:nil.
MethodMemoryUsage isEmpty ifTrue:[MethodMemoryUsage := nil].
].
+ MethodTiming notNil ifTrue:[
+ aMethod isWrapped ifTrue:[
+ MethodTiming removeKey:aMethod originalMethod ifAbsent:nil.
+ ].
+ MethodTiming removeKey:aMethod ifAbsent:nil.
+ MethodTiming isEmpty ifTrue:[MethodTiming := nil].
+ ].
CallingLevel := 0.
@@ -1075,8 +1084,8 @@
ObjectMemory flushCaches.
^ originalMethod
- "Modified: 20.5.1996 / 10:32:53 / cg"
"Modified: 5.6.1996 / 14:08:08 / stefan"
+ "Modified: 17.6.1996 / 17:20:43 / cg"
!
wrapMethod:aMethod onEntry:entryBlock onExit:exitBlock
@@ -1837,6 +1846,6 @@
!MessageTracer class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.40 1996-06-17 15:19:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.41 1996-06-17 15:21:20 cg Exp $'
! !
MessageTracer initialize!
--- a/MsgTracer.st Mon Jun 17 17:19:09 1996 +0200
+++ b/MsgTracer.st Mon Jun 17 17:21:20 1996 +0200
@@ -680,35 +680,6 @@
"Modified: 15.12.1995 / 15:45:15 / cg"
!
-executionTimesOfMethod:aMethod
- "return the current times"
-
- |count info min max avg ret|
-
- count := min := max := avg := 0.
- MethodTiming notNil ifTrue:[
- aMethod isWrapped ifTrue:[
- info := MethodTiming at:aMethod originalMethod ifAbsent:nil.
- info notNil ifTrue:[
- count := info at:1.
- min := info at:2.
- max := info at:3.
- avg := ((info at:4) / count) roundTo:0.01
- ].
- ].
- ].
-
- ret := IdentityDictionary new.
- ret at:#count put:count.
- ret at:#minTime put:min.
- ret at:#maxTime put:max.
- ret at:#avgTime put:avg.
- ^ ret
-
- "Created: 17.6.1996 / 17:07:30 / cg"
- "Modified: 17.6.1996 / 17:08:24 / cg"
-!
-
isCounting:aMethod
"return true if aMethod is counted"
@@ -723,90 +694,12 @@
"Modified: 15.12.1995 / 15:42:10 / cg"
!
-isTiming:aMethod
- "return true if aMethod is timed"
-
- MethodTiming isNil ifTrue:[^ false].
- (MethodTiming includesKey:aMethod) ifTrue:[^ true].
- aMethod isWrapped ifTrue:[
- ^ MethodTiming includesKey:aMethod originalMethod
- ].
- ^ false
-
- "Modified: 15.12.1995 / 15:42:10 / cg"
- "Created: 17.6.1996 / 17:04:29 / cg"
-!
-
stopCountingMethod:aMethod
"remove counting of aMethod"
^ self unwrapMethod:aMethod
"Modified: 15.12.1995 / 15:43:53 / cg"
-!
-
-stopTimingMethod:aMethod
- "remove timing of aMethod"
-
- ^ self unwrapMethod:aMethod
-
- "Modified: 15.12.1995 / 15:43:53 / cg"
- "Created: 17.6.1996 / 17:04:03 / cg"
-!
-
-timeMethod:aMethod
- "arrange for a aMethods execution time to be measured.
- Use unwrapMethod to remove this."
-
- |lvl inside t0|
-
- MethodTiming isNil ifTrue:[
- MethodTiming := IdentityDictionary new.
- ].
- MethodTiming removeKey:aMethod ifAbsent:nil.
-
- ^ self wrapMethod:aMethod
- onEntry:[:con |
- t0 := OperatingSystem getMillisecondTime.
- ]
- onExit:[:con :retVal |
- |info t cnt min max sumTimes|
-
- t := OperatingSystem getMillisecondTime - t0.
- info := MethodTiming at:aMethod ifAbsent:nil.
- info isNil ifTrue:[
- MethodTiming at:aMethod put:(Array with:1
- with:t
- with:t
- with:t)
- ] ifFalse:[
- cnt := info at:1.
- min := info at:2.
- max := info at:3.
- sumTimes := info at:4.
- t < min ifTrue:[
- info at:2 put:t
- ] ifFalse:[
- t > max ifTrue:[
- info at:3 put:t
- ]
- ].
- info at:4 put:(sumTimes + t).
- info at:1 put:cnt + 1
- ].
- ]
-
- "
- MessageTracer timeMethod:(Integer compiledMethodAt:#factorial).
- 5 factorial.
- 5 factorial.
- 5 factorial.
- (MessageTracer executionTimesOfMethod:(Integer compiledMethodAt:#factorial)) printCR.
- MessageTracer stopTimingMethod:(Integer compiledMethodAt:#factorial)
- "
-
- "Created: 17.6.1996 / 17:03:50 / cg"
- "Modified: 17.6.1996 / 17:10:43 / cg"
! !
!MessageTracer class methodsFor:'method memory usage'!
@@ -910,6 +803,115 @@
"Modified: 18.12.1995 / 21:54:36 / stefan"
! !
+!MessageTracer class methodsFor:'method timing'!
+
+executionTimesOfMethod:aMethod
+ "return the current times"
+
+ |count info min max avg ret|
+
+ count := min := max := avg := 0.
+ MethodTiming notNil ifTrue:[
+ aMethod isWrapped ifTrue:[
+ info := MethodTiming at:aMethod originalMethod ifAbsent:nil.
+ info notNil ifTrue:[
+ count := info at:1.
+ min := info at:2.
+ max := info at:3.
+ avg := ((info at:4) / count) roundTo:0.01
+ ].
+ ].
+ ].
+
+ ret := IdentityDictionary new.
+ ret at:#count put:count.
+ ret at:#minTime put:min.
+ ret at:#maxTime put:max.
+ ret at:#avgTime put:avg.
+ ^ ret
+
+ "Created: 17.6.1996 / 17:07:30 / cg"
+ "Modified: 17.6.1996 / 17:08:24 / cg"
+!
+
+isTiming:aMethod
+ "return true if aMethod is timed"
+
+ MethodTiming isNil ifTrue:[^ false].
+ (MethodTiming includesKey:aMethod) ifTrue:[^ true].
+ aMethod isWrapped ifTrue:[
+ ^ MethodTiming includesKey:aMethod originalMethod
+ ].
+ ^ false
+
+ "Modified: 15.12.1995 / 15:42:10 / cg"
+ "Created: 17.6.1996 / 17:04:29 / cg"
+!
+
+stopTimingMethod:aMethod
+ "remove timing of aMethod"
+
+ ^ self unwrapMethod:aMethod
+
+ "Modified: 15.12.1995 / 15:43:53 / cg"
+ "Created: 17.6.1996 / 17:04:03 / cg"
+!
+
+timeMethod:aMethod
+ "arrange for a aMethods execution time to be measured.
+ Use unwrapMethod to remove this."
+
+ |lvl inside t0|
+
+ MethodTiming isNil ifTrue:[
+ MethodTiming := IdentityDictionary new.
+ ].
+ MethodTiming removeKey:aMethod ifAbsent:nil.
+
+ ^ self wrapMethod:aMethod
+ onEntry:[:con |
+ t0 := OperatingSystem getMillisecondTime.
+ ]
+ onExit:[:con :retVal |
+ |info t cnt min max sumTimes|
+
+ t := OperatingSystem getMillisecondTime - t0.
+ info := MethodTiming at:aMethod ifAbsent:nil.
+ info isNil ifTrue:[
+ MethodTiming at:aMethod put:(Array with:1
+ with:t
+ with:t
+ with:t)
+ ] ifFalse:[
+ cnt := info at:1.
+ min := info at:2.
+ max := info at:3.
+ sumTimes := info at:4.
+ t < min ifTrue:[
+ info at:2 put:t
+ ] ifFalse:[
+ t > max ifTrue:[
+ info at:3 put:t
+ ]
+ ].
+ info at:4 put:(sumTimes + t).
+ info at:1 put:cnt + 1
+ ].
+ ]
+
+ "
+ MessageTracer timeMethod:(Integer compiledMethodAt:#factorial).
+ 5 factorial.
+ 5 factorial.
+ 5 factorial.
+ (MessageTracer executionTimesOfMethod:(Integer compiledMethodAt:#factorial)) printCR.
+ MessageTracer stopTimingMethod:(Integer compiledMethodAt:#factorial)
+ "
+
+ "Created: 17.6.1996 / 17:03:50 / cg"
+ "Modified: 17.6.1996 / 17:10:43 / cg"
+! !
+
!MessageTracer class methodsFor:'method tracing'!
traceMethod:aMethod
@@ -1039,6 +1041,13 @@
MethodMemoryUsage removeKey:aMethod ifAbsent:nil.
MethodMemoryUsage isEmpty ifTrue:[MethodMemoryUsage := nil].
].
+ MethodTiming notNil ifTrue:[
+ aMethod isWrapped ifTrue:[
+ MethodTiming removeKey:aMethod originalMethod ifAbsent:nil.
+ ].
+ MethodTiming removeKey:aMethod ifAbsent:nil.
+ MethodTiming isEmpty ifTrue:[MethodTiming := nil].
+ ].
CallingLevel := 0.
@@ -1075,8 +1084,8 @@
ObjectMemory flushCaches.
^ originalMethod
- "Modified: 20.5.1996 / 10:32:53 / cg"
"Modified: 5.6.1996 / 14:08:08 / stefan"
+ "Modified: 17.6.1996 / 17:20:43 / cg"
!
wrapMethod:aMethod onEntry:entryBlock onExit:exitBlock
@@ -1837,6 +1846,6 @@
!MessageTracer class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/Attic/MsgTracer.st,v 1.40 1996-06-17 15:19:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/Attic/MsgTracer.st,v 1.41 1996-06-17 15:21:20 cg Exp $'
! !
MessageTracer initialize!