[squeak-dev] The Trunk: System-ul.253.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Feb 14 08:19:02 UTC 2010
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.253.mcz
==================== Summary ====================
Name: System-ul.253
Author: ul
Time: 14 February 2010, 9:12:11.268 am
UUID: 7aaed65b-d0e3-0040-8929-0eb0bf8ecf64
Ancestors: System-ar.252
- fix (again): Timer may be already nil in the #ensure: block in MessageTally >> #spyEvery:on: and MessageTally >> #spyAllEvery:on:
=============== Diff against System-ar.252 ===============
Item was changed:
----- Method: MessageTally>>spyAllEvery:on: (in category 'initialize-release') -----
spyAllEvery: millisecs on: aBlock
"Create a spy and spy on the given block at the specified rate."
"Spy all the system processes"
| myDelay time0 |
(aBlock isMemberOf: BlockClosure)
ifFalse: [self error: 'spy needs a block here'].
self class: aBlock receiver class method: aBlock method.
"set up the probe"
myDelay := Delay forMilliseconds: millisecs.
time0 := Time millisecondClockValue.
gcStats := SmalltalkImage current getVMParameters.
Timer ifNotNil: [ Timer terminate ].
Timer := [
[true] whileTrue: [
| observedProcess startTime |
startTime := Time millisecondClockValue.
myDelay wait.
observedProcess := Processor preemptedProcess.
self
tally: observedProcess suspendedContext
in: observedProcess
"tally can be > 1 if ran a long primitive"
by: (Time millisecondClockValue - startTime) // millisecs].
nil] newProcess.
Timer priority: Processor timingPriority-1.
"activate the probe and evaluate the block"
Timer resume.
^ aBlock ensure: [
"Collect gc statistics"
SmalltalkImage current getVMParameters keysAndValuesDo: [ :idx :gcVal |
gcStats at: idx put: (gcVal - (gcStats at: idx))].
"cancel the probe and return the value"
+ Timer ifNotNil: [
+ Timer terminate.
+ Timer := nil ].
- Timer terminate.
- Timer := nil.
time := Time millisecondClockValue - time0]!
Item was changed:
----- Method: MessageTally>>spyEvery:on: (in category 'initialize-release') -----
spyEvery: millisecs on: aBlock
"Create a spy and spy on the given block at the specified rate."
"Spy only on the active process (in which aBlock is run)"
| myDelay time0 observedProcess |
(aBlock isMemberOf: BlockClosure)
ifFalse: [self error: 'spy needs a block here'].
self class: aBlock receiver class method: aBlock method.
"set up the probe"
observedProcess := Processor activeProcess.
myDelay := Delay forMilliseconds: millisecs.
time0 := Time millisecondClockValue.
gcStats := SmalltalkImage current getVMParameters.
Timer ifNotNil: [ Timer terminate ].
Timer := [
[true] whileTrue: [
| startTime |
startTime := Time millisecondClockValue.
myDelay wait.
self
tally: Processor preemptedProcess suspendedContext
in: (observedProcess == Processor preemptedProcess ifTrue: [observedProcess] ifFalse: [nil])
"tally can be > 1 if ran a long primitive"
by: (Time millisecondClockValue - startTime) // millisecs].
nil] newProcess.
Timer priority: Processor timingPriority-1.
"activate the probe and evaluate the block"
Timer resume.
^ aBlock ensure: [
"Collect gc statistics"
SmalltalkImage current getVMParameters keysAndValuesDo: [ :idx :gcVal |
gcStats at: idx put: (gcVal - (gcStats at: idx))].
"cancel the probe and return the value"
+ Timer ifNotNil: [
+ Timer terminate.
+ Timer := nil ].
- Timer terminate.
- Timer := nil.
time := Time millisecondClockValue - time0]!
More information about the Squeak-dev
mailing list
|