changed:
#execute
#spyOn:interval:
#spyOn:interval:to:
return the value of the spied block
--- a/MessageTally.st Tue Feb 02 12:12:08 2010 +0100
+++ b/MessageTally.st Tue Feb 02 15:18:57 2010 +0100
@@ -9,7 +9,6 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-
"{ Package: 'stx:libbasic3' }"
Object subclass:#MessageTally
@@ -188,19 +187,20 @@
spyOn:aBlock interval:ms to:outStream
"evaluate aBlock and output full statistics on outstream"
- |aTally|
+ |aTally retVal|
aTally := self new.
[
[
- aTally spyOn:aBlock interval:ms.
+ retVal := aTally spyOn:aBlock interval:ms.
] ifCurtailed:[
outStream nextPutLine:'TALLY: block returned'.
]
] ensure:[
aTally printFullStatisticOn:outStream
].
+ ^ retVal
"Modified: 22.3.1997 / 16:54:36 / cg"
! !
@@ -421,7 +421,7 @@
"evaluate the target block"
executing := true.
- theBlock value
+ ^ theBlock value
"Modified: 20.3.1997 / 21:36:27 / cg"
! !
@@ -631,50 +631,55 @@
spyOn:aBlock interval:ms
"spy on execution time, generate a hierarchical call information"
- |probing delay probingProcess probedProcess|
+ |probing delay probingProcess probedProcess retVal|
theBlock := aBlock.
- Processor activeProcess withPriority:(Processor userInterruptPriority-1) do:[
+ Processor activeProcess
+ withPriority:(Processor userInterruptPriority-1)
+ do:[
- probingProcess := [
- |p|
+ probingProcess := [
+ |p|
- p := probedProcess.
- [probing] whileTrue:[
- delay wait.
- executing ifTrue:[
- self count:p suspendedContext
- ]
- ].
- ] newProcess.
+ p := probedProcess.
+ [probing] whileTrue:[
+ delay wait.
+ executing ifTrue:[
+ self count:p suspendedContext
+ ]
+ ].
+ ] newProcess.
- probingProcess priority:(Processor userInterruptPriority+1).
+ probingProcess priority:(Processor userInterruptPriority+1).
- delay := (Delay forMilliseconds:ms).
- ntally := 0.
+ delay := (Delay forMilliseconds:ms).
+ ntally := 0.
- tree := ProfileTree new.
- tree receiver:MessageTally
- selector:#execute
+ tree := ProfileTree new.
+ tree
+ receiver:MessageTally
+ selector:#execute
class:MessageTally
- isBlock:false.
+ isBlock:false.
- probedProcess := Processor activeProcess.
+ probedProcess := Processor activeProcess.
- executing := false.
- probing := true.
- probingProcess resume.
+ executing := false.
+ probing := true.
+ probingProcess resume.
- [
- startTime := OperatingSystem getMillisecondTime.
- self execute.
- ] ensure:[
- probing := executing := false.
- theBlock := nil.
- endTime := OperatingSystem getMillisecondTime.
+ [
+ startTime := OperatingSystem getMillisecondTime.
+ retVal := self execute.
+ ] ensure:[
+ probing := executing := false.
+ theBlock := nil.
+ endTime := OperatingSystem getMillisecondTime.
+ ].
].
- ].
+
+ ^ retVal
"Created: 20.3.1997 / 20:14:44 / cg"
"Modified: 22.3.1997 / 16:45:42 / cg"
@@ -683,5 +688,9 @@
!MessageTally class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/MessageTally.st,v 1.44 2006-01-09 08:57:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/MessageTally.st,v 1.45 2010-02-02 14:18:57 cg Exp $'
+!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libbasic3/MessageTally.st,v 1.45 2010-02-02 14:18:57 cg Exp $'
! !