A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-ael.488.mcz==================== Summary ====================
Name: System-ael.488
Author: ael
Time: 10 July 2012, 1:56:20.102 pm
UUID: 18e76459-4ed0-478c-b2b3-9d587d1f6b3d
Ancestors: System-eem.487
Tentative fix for 'tally is already running' error when profiling from ProcessBrowser.
=============== Diff against System-eem.487 ===============
Item was changed:
----- Method: MessageTally>>spyEvery:onProcess:forMilliseconds: (in category 'initialize-release') -----
spyEvery: millisecs onProcess: aProcess forMilliseconds: msecDuration
"Create a spy and spy on the given process at the specified rate."
| myDelay time0 endTime observedProcess sem |
(aProcess isKindOf: Process)
ifFalse: [self error: 'spy needs a Process here'].
self class: aProcess suspendedContext receiver class method: aProcess suspendedContext method.
"set up the probe"
observedProcess := aProcess.
myDelay := Delay forMilliseconds: millisecs.
time0 := Time millisecondClockValue.
endTime := time0 + msecDuration.
sem := Semaphore new.
gcStats := SmalltalkImage current getVMParameters.
Timer ifNotNil: [ self error: 'it seems a tally is already running' ].
Timer := [
[
| 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.
startTime < endTime
] whileTrue.
sem signal.
] newProcess.
Timer priority: Processor timingPriority-1.
"activate the probe and evaluate the block"
Timer resume.
"activate the probe and wait for it to finish"
sem wait.
+ Timer ifNotNil: [
+ Timer terminate.
+ Timer := nil ].
"Collect gc statistics"
SmalltalkImage current getVMParameters keysAndValuesDo: [ :idx :gcVal |
gcVal ifNotNil: [ gcStats at: idx put: (gcVal - (gcStats at: idx)) ] ].
time := Time millisecondClockValue - time0!