--- a/MessageTracer.st Mon Jul 27 12:40:12 1998 +0200
+++ b/MessageTracer.st Thu Jul 30 16:53:29 1998 +0200
@@ -838,11 +838,12 @@
!MessageTracer class methodsFor:'method timing'!
executionTimesOfMethod:aMethod
- "return the current times"
+ "return the current gather execution times"
|count info minT maxT avg ret|
- count := minT := maxT := avg := 0.
+ count := 0.
+ minT := maxT := avg := nil.
MethodTiming notNil ifTrue:[
aMethod isWrapped ifTrue:[
info := MethodTiming at:aMethod originalMethod ifAbsent:nil.
@@ -857,6 +858,16 @@
].
].
+ (minT notNil and:[minT > 10]) ifTrue:[
+ minT := minT roundTo:0.1
+ ].
+ (maxT notNil and:[maxT > 10]) ifTrue:[
+ maxT := maxT roundTo:0.1
+ ].
+ (avg notNil and:[avg > 10]) ifTrue:[
+ avg := avg roundTo:0.1
+ ].
+
ret := IdentityDictionary new.
ret at:#count put:count.
ret at:#minTime put:minT.
@@ -864,8 +875,8 @@
ret at:#avgTime put:avg.
^ ret
- "Created: 17.6.1996 / 17:07:30 / cg"
- "Modified: 11.4.1997 / 17:16:11 / cg"
+ "Created: / 17.6.1996 / 17:07:30 / cg"
+ "Modified: / 30.7.1998 / 16:51:44 / cg"
!
stopTimingMethod:aMethod
@@ -881,7 +892,7 @@
"arrange for a aMethods execution time to be measured.
Use unwrapMethod to remove this."
- |t0|
+ |t0 timeToGetTime|
MethodTiming isNil ifTrue:[
MethodTiming := IdentityDictionary new.
@@ -892,14 +903,20 @@
with:0
with:0).
+ t0 := OperatingSystem getMicrosecondTime.
+ timeToGetTime := (OperatingSystem getMicrosecondTime - t0).
+
^ self wrapMethod:aMethod
onEntry:[:con |
- t0 := OperatingSystem getMillisecondTime.
+ t0 := OperatingSystem getMicrosecondTime.
]
onExit:[:con :retVal |
|info t cnt minT maxT sumTimes|
- t := OperatingSystem getMillisecondTime - t0.
+ t := OperatingSystem getMicrosecondTime - t0.
+ t := t - timeToGetTime.
+ t := t / 1000.0.
+
info := MethodTiming at:aMethod ifAbsent:nil.
info isNil ifTrue:[
MethodTiming at:aMethod put:(Array with:1
@@ -908,15 +925,21 @@
with:t)
] ifFalse:[
cnt := info at:1.
- minT := info at:2.
- maxT := info at:3.
sumTimes := info at:4.
- t < minT ifTrue:[
- info at:2 put:t
+
+ cnt == 0 ifTrue:[
+ info at:2 put:t.
+ info at:3 put:t.
] ifFalse:[
- t > maxT ifTrue:[
- info at:3 put:t
- ]
+ minT := info at:2.
+ maxT := info at:3.
+ t < minT ifTrue:[
+ info at:2 put:t.
+ ] ifFalse:[
+ t > maxT ifTrue:[
+ info at:3 put:t.
+ ]
+ ].
].
info at:4 put:(sumTimes + t).
info at:1 put:cnt + 1
@@ -934,7 +957,7 @@
"
"Created: / 17.6.1996 / 17:03:50 / cg"
- "Modified: / 27.7.1998 / 10:48:10 / cg"
+ "Modified: / 30.7.1998 / 16:48:25 / cg"
! !
!MessageTracer class methodsFor:'method tracing'!
@@ -2601,6 +2624,6 @@
!MessageTracer class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.67 1998-07-27 10:36:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.68 1998-07-30 14:53:29 cg Exp $'
! !
MessageTracer initialize!