Upload
esug
View
245
Download
3
Tags:
Embed Size (px)
DESCRIPTION
ESUG 2012, Ghent
Citation preview
Object-centric profiling:Advanced Visualizations to Tame Wild
Program Execution
Vanessa Peña, Juan Pablo Sandoval, Pablo Estefo, Alexandre Bergel
Object Profile & University of Chile
2
Execution profiling with Kai
Problem:
Traditional code profilers are driven by the method stack, discarding the notion of sending messages
Why the problem is important:
How to answer to “Is there a slow function that is called too often?”
Solution:
An intuitive visual representation of the execution that visually compare the time spent and the number of executions
3
54.8% {11501ms} MOCanvas>>drawOn: 54.8% {11501ms} MORoot(MONode)>>displayOn: 30.9% {6485ms} MONode>>displayOn: | 18.1% {3799ms} MOEdge>>displayOn: ... | 8.4% {1763ms} MOEdge>>displayOn: | | 8.0% {1679ms} MOStraightLineShape>>display:on: | | 2.6% {546ms} FormCanvas>>line:to:width:color: ... 23.4% {4911ms} MOEdge>>displayOn: ...
Execution sampling profiler
4
Structural profiling blueprint
legend for methods
(color)
#different
receiver
# executions
execution
time
5
Behavioral profiling blueprint
6
legend for methods
gray = side
effect
yellow = no side effect
# executions
execution time
m2m1
invokes m2 and m3
m1 m3
DEMO
Structural profiling blueprint
legend for methods
(color)
#different
receiver
# executions
execution
time
bounds
7
legend for methods
gray = side
effect
yellow = no side effect
# executions
execution time
m2m1
invokes m2 and m3
m1 m3
Behavioral profiling blueprint
bounds8
Code of the bounds method
MOGraphElement>>bounds "Answer the bounds of the receiver."
| basicBounds |
self shapeBoundsAt: self shape ifPresent: [ :b | ^ b ].
basicBounds := shape computeBoundsFor: self. self shapeBoundsAt: self shape put: basicBounds.
^ basicBounds
9
Memoizing
MOGraphElement>>bounds "Answer the bounds of the receiver."
| basicBounds | boundsCache ifNotNil: [ ^ boundsCache ]. self shapeBoundsAt: self shape ifPresent: [ :b | ^ b ].
basicBounds := shape computeBoundsFor: self. self shapeBoundsAt: self shape put: basicBounds.
^ boundsCache := basicBounds
10
A
B
C
Upgrading MOGraphElement>>bounds
11
A
B
C
Upgrading MOGraphElement>>bounds
43%speedup
12
B
A
Upgrading MOGraphElement>>bounds
13
AB C D
cached
absoluteBoundsmake display:on:
call absoluteBoundsinstead of absoluteBoundsFor:
A'
C'
B'
C'
14
AB C D
cached
absoluteBoundsmake display:on:
call absoluteBoundsinstead of absoluteBoundsFor:
A'
C'
B'
C'
15
AB C D
cached
absoluteBoundsmake display:on:
call absoluteBoundsinstead of absoluteBoundsFor:
A'
C'
B'
C'
16
Test coverage with Hapao
Problem:
Traditional code coverage tools have a binary view of the world
Why the problem is important:
Which method should you test first in order to increase the coverage?
Is my code well covered or not?
Solution:
An intuitive visual representation of a qualitative assessment of the coverage
17
Test blueprint
cd
# calling methods
complexity # executions
Legend for methods (inner boxes)
red = not executedblue = abstract
invocation on self
C1
C2
18DEMO
Successive improvement
Version 2.227.27%
Version 2.354.54%
Version 2.487.71%
Version 2.5100%
19
4 patterns
20
Moose-Test-Core.13 Moose-Core.313
Moose-Test-Core.48 Moose-Core.326
21.42%
56.86%
73.58%
68.25%
0%
36.78%
100%
96.66%
64.55%
100%
100%
100%
21
Reducing code complexity
Version 1.58.1Coverage: 40.57%
Version 1.58.9Coverage: 60.60%
22
Reducing code complexity
Version 2.10
Version 2.1723
Visualizing data with Roassal
Roassal is an agile and interactive visualization engine
Visualizing Incidents at the Fire Department of NY
Supported Platforms
XMLTokenizer>>nextName
XMLNestedStreamReader>>atEnd
node color
∆ number of executions
∆ numberof
messages
source code red: change black: do not change
green: # messages < than before
light red: # messages > than before and # executions <= than before
red: # messages > than before and # executions > than before
white: # messages = than before
yellow: this method did not exist before
Legend for methods
m1
m2m1 invokes m2
Multidimentional profiling
Differences between tests
Conclusion
Little innovation in the tools we commonly use
Profilers, debuggers, testing tools have not significantly evolved
Fantastic opportunities for improvement
Kai, Hapao and Roassal are just a beginning
Feel free to provide feedback on our tool
30
Spy @ Cincom StoreSpy @ SqueakSourceRoassal @ ...
ObjectProfile.com
Moose-Test-Core.13 Moose-Core.313
Moose-Test-Core.48 Moose-Core.326
21.42%
56.86%
73.58%
68.25%
0%
36.78%
100%
96.66%
64.55%
100%
100%
100%
Thanks to ESUG Chris T Cincom All of you guys!