0
Visualizing Dynamic
Metrics with Profiling
     Blueprints
Alexandre Bergel, Romain Robbes, Walter Binder
        Universit...
{               {
    {                   {
                            }
        }
        }
            }       {       ...
1.4
{
                                5.2
                {
    {
        }
        }
                        {
          ...
1.4
{
                                5.2             }
                {
                                5.6
            ...
gprof: flat profile
Flat profile:

Each sample counts as 0.01 seconds.

%       cumulative   self               self     tot...
gprof: call graph (~1984)
    index % time    self   children    called     name
                                         ...
YourKit




          7
YourKit




          8
JProfiler




           9
JProfiler




           10
JProfiler




           11
Retrospective on profiling



Information conveyed hasn’t evolved since gprof
Useful to understand what happened
But is of ...
Roadmap




1.Polymetric views
2.Profiling Blueprint
3.Implementation




                                 13
Polymetric view can map up to 5
               dimensions
                   width property



                       colo...
KaiProfiler
  viewProfiling: [
    | view |

   view := MOViewRenderer new.

   view
      nodes: (1 to: 100)
      forEac...
Structural blueprint




                  legend for methods
                                 # executions




          ...
Structural blueprint




bounds



                           legend for methods
                                         ...
Behavioral blueprint




              legend for methods
                             # executions


                    ...
Behavioral blueprint




                  legend for methods
                                 # executions


            ...
Detailed behavioral blueprint

                       computeExtentHavingChildrenFor:




                                ...
Code of the bounds method

MOGraphElement>>bounds
 "Answer the bounds of the receiver."

 | basicBounds |

 self shapeBoun...
Memoizing

MOGraphElement>>bounds
 "Answer the bounds of the receiver."

 | basicBounds |
 boundsCache ifNotNil: [ ^ bound...
Upgrading
        MOGraphElement>>bounds


A

    B

                     C




                                 23
43%
speedup             Upgrading
              MOGraphElement>>bounds


      A

          B

                           ...
A




      Upgrading
MOGraphElement>>bounds




                             B




                                 25
B                  C
                      A




    cached
absoluteBounds
                                               ...
B                  C
                      A                                                          D




    cached
   ...
B                  C                                   D




                              make display:on:
              ...
Implementation


We use the following metrics:
  execution time for a method (% and ms)

  number of executions

  number ...
Naive (but effective) implementation


 Code to profile is executed twice
   using a sampling method to get the execution t...
Implementation techniques




  Visualizations are generated using a scripting
languages
 ... in Mondrian




            ...
Implemented in Pharo
Smalltalk dialect
Dynamically typed language




                             30
Conclusion




Effective visualizations
Smooth integration in the programming environment
Implemented in Pharo




       ...
Conclusion



 A number of bottlenecks were identified
 No general rule for pattern identification
 Visualizations are effec...
Conclusion



Future work
  close integration in the programming environment

  dedicated visualization for comparison

  ...
Visualizing Dynamic Metrics with Profiling
               Blueprints

 www.moosetechnology.org/tools/Spy




  A           ...
Upcoming SlideShare
Loading in...5
×

Profiling blueprints

1,010

Published on

Alexandre Bergel, Romain Robbes and Walter Binder, Visualizing Dynamic Metrics with Profiling Blueprints, In Proceedings of the 48th International Conference on Objects, Models, Components, Patterns (TOOLS EUROPE'10), July 2010, LNCS Springer Verlag

http://www.bergel.eu/download/papers/Berg10aProfiling.pdf

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,010
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
































  • Whether an optimization can be realized depends on many parameters not easily detectable.


  • Transcript of "Profiling blueprints"

    1. 1. Visualizing Dynamic Metrics with Profiling Blueprints Alexandre Bergel, Romain Robbes, Walter Binder University of Chile University of Chile Lugano
    2. 2. { { { { } } } } { } 2
    3. 3. 1.4 { 5.2 { { } } { } 5.6 } { } 2.3 0.5 ... 3
    4. 4. 1.4 { 5.2 } { 5.6 } { { } } } { } } } { 2.3 { } { } { { 0.5 ... Understanding why 4
    5. 5. gprof: flat profile Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 33.34 0.02 0.02 7208 0.00 0.00 open 16.67 0.03 0.01 244 0.04 0.12 offtime 16.67 0.04 0.01 8 1.25 1.25 memccpy 16.67 0.05 0.01 7 1.43 1.43 write 16.67 0.06 0.01 mcount 0.00 0.06 0.00 236 0.00 0.00 tzset 0.00 0.06 0.00 192 0.00 0.00 tolower 0.00 0.06 0.00 47 0.00 0.00 strlen 0.00 0.06 0.00 45 0.00 0.00 strchr 5
    6. 6. gprof: call graph (~1984) index % time self children called name <spontaneous> [1] 100.0 0.00 0.05 start [1] 0.00 0.05 1/1 main [2] 0.00 0.00 1/2 on_exit [28] 0.00 0.00 1/1 exit [59] ----------------------------------------------- 0.00 0.05 1/1 start [1] [2] 100.0 0.00 0.05 1 main [2] 0.00 0.05 1/1 report [3] ----------------------------------------------- 0.00 0.05 1/1 main [2] [3] 100.0 0.00 0.05 1 report [3] 0.00 0.03 8/8 timelocal [6] 0.00 0.01 1/1 print [9] 0.00 0.01 9/9 fgets [12] 0.00 0.00 12/34 strncmp <cycle 1> [40] 0.00 0.00 8/8 lookup [20] 0.00 0.00 1/1 fopen [21] 0.00 0.00 8/8 chewtime [24] 0.00 0.00 8/16 skipspace [44] ----------------------------------------------- [4] 59.8 0.01 0.02 8+472 <cycle 2 as a whole> [4] 0.01 0.02 244+260 offtime <cycle 2> [7] 0.00 0.00 236+1 tzset <cycle 2> [26] ----------------------------------------------- 6
    7. 7. YourKit 7
    8. 8. YourKit 8
    9. 9. JProfiler 9
    10. 10. JProfiler 10
    11. 11. JProfiler 11
    12. 12. Retrospective on profiling Information conveyed hasn’t evolved since gprof Useful to understand what happened But is of little help to understand why and how Is there a “slow” function that is called too often? What makes a function “slow”? 12
    13. 13. Roadmap 1.Polymetric views 2.Profiling Blueprint 3.Implementation 13
    14. 14. Polymetric view can map up to 5 dimensions width property color height property property X property Y property [Lanza 2003] 14
    15. 15. KaiProfiler viewProfiling: [ | view | view := MOViewRenderer new. view nodes: (1 to: 100) forEach: [:each | view nodes: (1 to: 100)]. view root applyLayout ] 15
    16. 16. Structural blueprint legend for methods # executions (color) execution #different time receiver 16
    17. 17. Structural blueprint bounds legend for methods # executions (color) execution #different time receiver 17
    18. 18. Behavioral blueprint legend for methods # executions gray = return m1 m3 self execution m1 time yellow = invokes constant m2 m2 and m3 on return value 18
    19. 19. Behavioral blueprint legend for methods # executions gray = return m1 m3 self execution m1 time yellow = invokes m2 m2 and m3 bounds constant on return value 19
    20. 20. Detailed behavioral blueprint computeExtentHavingChildrenFor: MOGraphElement>> origin Calling #bounds bounds Called by #bounds shapeBoundsAt:ifPresent: 20
    21. 21. 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 21
    22. 22. 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 22
    23. 23. Upgrading MOGraphElement>>bounds A B C 23
    24. 24. 43% speedup Upgrading MOGraphElement>>bounds A B C 24
    25. 25. A Upgrading MOGraphElement>>bounds B 25
    26. 26. B C A cached absoluteBounds ins A' C' B' C' 26
    27. 27. B C A D cached make display:on: absoluteBounds call absoluteBounds instead of absoluteBoundsFor: A' C' B' C' 26
    28. 28. B C D make display:on: call absoluteBounds instead of absoluteBoundsFor: C' B' C' 26
    29. 29. Implementation We use the following metrics: execution time for a method (% and ms) number of executions number of different object receivers Dynamic properties a method performs a side effect a method is void (i.e., return self in Pharo) 27
    30. 30. Naive (but effective) implementation Code to profile is executed twice using a sampling method to get the execution time instrumentation to get all the remaining metrics Use hash values to distinguish between different receiver objects Built a kind of AOP mechanism for the low level instrumentation 28
    31. 31. Implementation techniques Visualizations are generated using a scripting languages ... in Mondrian 29
    32. 32. Implemented in Pharo Smalltalk dialect Dynamically typed language 30
    33. 33. Conclusion Effective visualizations Smooth integration in the programming environment Implemented in Pharo 31
    34. 34. Conclusion A number of bottlenecks were identified No general rule for pattern identification Visualizations are effective for identifying potential candidate for optimization 32
    35. 35. Conclusion Future work close integration in the programming environment dedicated visualization for comparison additional metrics, e.g., the number of executed bytecodes, memory usage 33
    36. 36. Visualizing Dynamic Metrics with Profiling Blueprints www.moosetechnology.org/tools/Spy A Alexandre Bergel, Romain Robbes, Walter Binder B C abergel@dcc.uchile.cl 34
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×