[squeak-dev] code coverage
Bob Arning
arning315 at comcast.net
Thu Feb 21 22:25:25 UTC 2013
In a much older Squeak, I just stepped though code like the debugger and
recorded every PC that was executed. I could then pretty-print every
method and color the parts executed or not differently. Was rather slow
and did have trouble trying to step through primitives, but could yield
nice results. The guts of it was this:
tallyCoverageInner: aBlock
| tick str list smallSteps bigSteps incr prevContext |
SequentialEventManager classNow: 0.
smallSteps _ bigSteps _ 0.
incr _ 200000.
tick _ Time millisecondClockValue.
byteCodeTallies _ IdentityDictionary new: 10000.
prevContext _ nil.
thisContext sender
runSimulated: aBlock
contextAtEachStep: [ :current |
smallSteps _ smallSteps + 1.
smallSteps >= incr ifTrue: [
smallSteps _ 0.
bigSteps _ bigSteps + 1.
str _ (Time millisecondClockValue - tick / 1000)
rounded asString,' ',
(bigSteps * incr) asStringWithCommas,' ..
',byteCodeTallies size asString,' ',
(SequentialEventManager classNow ifNil: [0])
ddhhmm,' ',
(self who: current method) asString,' '.
Summary add: str.
str displayAt: 0 at 0.
].
prevContext == current ifFalse: [
prevContext _ current.
list _ byteCodeTallies
at: current method
ifAbsentPut: [ByteArray new: current method endPC + 1].
].
list at: current pc + 1 put: 1.
"bigSteps > 3 ifTrue: [^byteCodeTallies]."
].
^byteCodeTallies
On 2/21/13 2:52 PM, Eliot Miranda wrote:
> Hi All,
>
> anyone have any bytecode-to-bytecode transformation tools for
> doing basic-block resolution coverage?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130221/25adbfd5/attachment.htm
More information about the Squeak-dev
mailing list
|