[Pkg] The Trunk: System-ul.260.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Feb 23 23:16:15 UTC 2010
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.260.mcz
==================== Summary ====================
Name: System-ul.260
Author: ul
Time: 24 February 2010, 12:10:09.99 am
UUID: b3a36226-fa6a-e543-b255-d6fc3cb0f335
Ancestors: System-edc.259
- remove the remaining #close sends from MessageTally.
=============== Diff against System-edc.259 ===============
Item was changed:
----- Method: MessageTally class>>tallySendsTo:inBlock:showTree: (in category 'spying') -----
tallySendsTo: receiver inBlock: aBlock showTree: treeOption
"
MessageTally tallySends: [3.14159 printString]
"
"This method uses the simulator to count the number of calls on each method
invoked in evaluating aBlock. If receiver is not nil, then only sends
to that receiver are tallied.
Results are presented as leaves, sorted by frequency,
preceded, optionally, by the whole tree."
| prev tallies startTime totalTime |
startTime := Time millisecondClockValue.
tallies := MessageTally new class: aBlock receiver class method: aBlock method.
tallies reportOtherProcesses: true. "Do NOT filter nodes with nil process"
prev := aBlock.
thisContext sender
runSimulated: aBlock
contextAtEachStep: [ :current |
current == prev ifFalse: [ "call or return"
prev sender == nil ifFalse: [ "call only"
(receiver == nil or: [ current receiver == receiver ])
ifTrue: [ tallies tally: current by: 1 ] ].
prev := current ] ].
totalTime := Time millisecondClockValue - startTime // 1000.0 roundTo: 0.01.
(StringHolder new contents:
(String streamContents:
[:s |
s nextPutAll: 'This simulation took ' , totalTime printString
, ' seconds.'; cr.
treeOption
ifTrue: [ tallies fullPrintExactOn: s ]
+ ifFalse: [ tallies leavesPrintExactOn: s ] ]))
- ifFalse: [ tallies leavesPrintExactOn: s ].
- tallies close ]))
openLabel: 'Spy Results'!
Item was changed:
----- Method: MessageTally class>>spyOn:toFileNamed:reportOtherProcesses: (in category 'spying') -----
spyOn: aBlock toFileNamed: fileName reportOtherProcesses: aBoolean
"Spy on the evaluation of aBlock. Write the data collected on a file
named fileName."
+ | value node |
- | file value node |
node := self new.
node reportOtherProcesses: aBoolean.
value := node spyEvery: self defaultPollPeriod on: aBlock.
+ FileStream newFileNamed: fileName do: [ :file |
+ node report: file ].
- file := FileStream newFileNamed: fileName.
- node report: file; close.
- file close.
^value!
Item was changed:
----- Method: MessageTally class>>spyOnProcess:forMilliseconds:toFileNamed:reportOtherProcesses: (in category 'spying') -----
spyOnProcess: aProcess forMilliseconds: msecDuration toFileNamed: fileName reportOtherProcesses: aBoolean
"Spy on the evaluation of aProcess. Write the data collected on a file
named fileName. Will overwrite fileName"
+
+ | node |
- | file node |
node := self new.
node reportOtherProcesses: aBoolean.
node
spyEvery: self defaultPollPeriod
onProcess: aProcess
forMilliseconds: msecDuration.
+ FileStream fileNamed: fileName do: [ :file |
+ node report: file ]!
- file := FileStream fileNamed: fileName.
- node report: file;
- close.
- file close!
More information about the Packages
mailing list