31
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

Object Centric Profiling

  • Upload
    esug

  • View
    245

  • Download
    3

Embed Size (px)

DESCRIPTION

ESUG 2012, Ghent

Citation preview

Page 1: Object Centric Profiling

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

Page 2: Object Centric Profiling

2

Page 3: Object Centric Profiling

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

Page 4: Object Centric Profiling

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

Page 5: Object Centric Profiling

Structural profiling blueprint

legend for methods

(color)

#different

receiver

# executions

execution

time

5

Page 6: Object Centric Profiling

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

Page 7: Object Centric Profiling

Structural profiling blueprint

legend for methods

(color)

#different

receiver

# executions

execution

time

bounds

7

Page 8: Object Centric Profiling

legend for methods

gray = side

effect

yellow = no side effect

# executions

execution time

m2m1

invokes m2 and m3

m1 m3

Behavioral profiling blueprint

bounds8

Page 9: Object Centric Profiling

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

Page 10: Object Centric Profiling

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

Page 11: Object Centric Profiling

A

B

C

Upgrading MOGraphElement>>bounds

11

Page 12: Object Centric Profiling

A

B

C

Upgrading MOGraphElement>>bounds

43%speedup

12

Page 13: Object Centric Profiling

B

A

Upgrading MOGraphElement>>bounds

13

Page 14: Object Centric Profiling

AB C D

cached

absoluteBoundsmake display:on:

call absoluteBoundsinstead of absoluteBoundsFor:

A'

C'

B'

C'

14

Page 15: Object Centric Profiling

AB C D

cached

absoluteBoundsmake display:on:

call absoluteBoundsinstead of absoluteBoundsFor:

A'

C'

B'

C'

15

Page 16: Object Centric Profiling

AB C D

cached

absoluteBoundsmake display:on:

call absoluteBoundsinstead of absoluteBoundsFor:

A'

C'

B'

C'

16

Page 17: Object Centric Profiling

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

Page 18: Object Centric Profiling

Test blueprint

cd

# calling methods

complexity # executions

Legend for methods (inner boxes)

red = not executedblue = abstract

invocation on self

C1

C2

18DEMO

Page 19: Object Centric Profiling

Successive improvement

Version 2.227.27%

Version 2.354.54%

Version 2.487.71%

Version 2.5100%

19

Page 20: Object Centric Profiling

4 patterns

20

Page 21: Object Centric Profiling

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

Page 22: Object Centric Profiling

Reducing code complexity

Version 1.58.1Coverage: 40.57%

Version 1.58.9Coverage: 60.60%

22

Page 23: Object Centric Profiling

Reducing code complexity

Version 2.10

Version 2.1723

Page 24: Object Centric Profiling

Visualizing data with Roassal

Roassal is an agile and interactive visualization engine

Page 25: Object Centric Profiling

Visualizing Incidents at the Fire Department of NY

Page 26: Object Centric Profiling

Supported Platforms

Page 27: Object Centric Profiling
Page 28: Object Centric Profiling

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

Page 29: Object Centric Profiling

Differences between tests

Page 30: Object Centric Profiling

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

Page 31: Object Centric Profiling

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!