SlideShare une entreprise Scribd logo
1  sur  36
Visualizing Dynamic
Metrics with Profiling
     Blueprints
Alexandre Bergel, Romain Robbes, Walter Binder
        University of Chile       University of
              Chile                Lugano
{               {
    {                   {
                            }
        }
        }
            }       {       }




                                2
1.4
{
                                5.2
                {
    {
        }
        }
                        {
                            }   5.6
            }       {       }
                                2.3
                                0.5
                                ...



                                      3
1.4
{
                                5.2             }
                {
                                5.6
                                                    }
    {                   {                                   }
                            }                             } {
        }
        }                                               } {

                                2.3
                                                        {
            }       {       }                                   {
                                                                    {


                                0.5
                                ...   Understanding why




                                                                        4
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
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
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 little help to understand why and how
  Is there a “slow” function that is called too often?

  What makes a function “slow”?




                                                         12
Roadmap




1.Polymetric views
2.Profiling Blueprint
3.Implementation




                                 13
Polymetric view can map up to 5
               dimensions
                   width property



                       color         height
                     property       property
      X property


   Y
property




                                      [Lanza 2003]   14
KaiProfiler
  viewProfiling: [
    | view |

   view := MOViewRenderer new.

   view
      nodes: (1 to: 100)
      forEach: [:each |
        view nodes: (1 to: 100)].

   view root applyLayout

 ]




                                    15
Structural blueprint




                  legend for methods
                                 # executions




                                     (color)
                    execution
                                   #different
                      time
                                    receiver




                                                16
Structural blueprint




bounds



                           legend for methods
                                          # executions




                                              (color)
                             execution
                                            #different
                               time
                                             receiver




                                                         17
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
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
Detailed behavioral blueprint

                       computeExtentHavingChildrenFor:




                                            MOGraphElement>>
                                                 origin

    Calling #bounds



                                       bounds




   Called by #bounds
                       shapeBoundsAt:ifPresent:



                                                               20
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
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
Upgrading
        MOGraphElement>>bounds


A

    B

                     C




                                 23
43%
speedup             Upgrading
              MOGraphElement>>bounds


      A

          B

                           C




                                       24
A




      Upgrading
MOGraphElement>>bounds




                             B




                                 25
B                  C
                      A




    cached
absoluteBounds
                                                 ins




                 A'

                                        C'



                                   B'




                              C'

                                             26
B                  C
                      A                                                          D




    cached
                                                        make display:on:
absoluteBounds
                                                      call absoluteBounds
                                                 instead of absoluteBoundsFor:




                 A'

                                        C'



                                   B'




                              C'

                                                                                     26
B                  C                                   D




                              make display:on:
                            call absoluteBounds
                       instead of absoluteBoundsFor:




              C'



         B'




    C'

                                                           26
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
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
Implementation techniques




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




                                                   29
Implemented in Pharo
Smalltalk dialect
Dynamically typed language




                             30
Conclusion




Effective visualizations
Smooth integration in the programming environment
Implemented in Pharo




                                                    31
Conclusion



 A number of bottlenecks were identified
 No general rule for pattern identification
 Visualizations are effective for identifying potential
candidate for optimization




                                                          32
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
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

Contenu connexe

En vedette

Multi dimensional profiling
Multi dimensional profilingMulti dimensional profiling
Multi dimensional profiling
bergel
 

En vedette (7)

2006 Seaside
2006 Seaside2006 Seaside
2006 Seaside
 
tres fotos
tres fotostres fotos
tres fotos
 
2006 Esug Omnibrowser
2006 Esug Omnibrowser2006 Esug Omnibrowser
2006 Esug Omnibrowser
 
Power Point
Power PointPower Point
Power Point
 
2006 Small Scheme
2006 Small Scheme2006 Small Scheme
2006 Small Scheme
 
Multi dimensional profiling
Multi dimensional profilingMulti dimensional profiling
Multi dimensional profiling
 
2008 Sccc Smalltalk
2008 Sccc Smalltalk2008 Sccc Smalltalk
2008 Sccc Smalltalk
 

Similaire à Profiling blueprints

Simple asynchronous remote invocations for distributed real-time Java
Simple asynchronous remote invocations for distributed real-time JavaSimple asynchronous remote invocations for distributed real-time Java
Simple asynchronous remote invocations for distributed real-time Java
Universidad Carlos III de Madrid
 
Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)
yarry
 
May2010 hex-core-opt
May2010 hex-core-optMay2010 hex-core-opt
May2010 hex-core-opt
Jeff Larkin
 
กระบวนการเทคโนโลยีสารสนเทศ
กระบวนการเทคโนโลยีสารสนเทศกระบวนการเทคโนโลยีสารสนเทศ
กระบวนการเทคโนโลยีสารสนเทศ
JL'mind Chutimon
 
Climb – Chaining Operators - Report
Climb – Chaining Operators - ReportClimb – Chaining Operators - Report
Climb – Chaining Operators - Report
Christopher Chedeau
 
End to-end scheduling with ibm tivoli workload scheduler version 8.2 sg246624
End to-end scheduling with ibm tivoli workload scheduler version 8.2 sg246624End to-end scheduling with ibm tivoli workload scheduler version 8.2 sg246624
End to-end scheduling with ibm tivoli workload scheduler version 8.2 sg246624
Banking at Ho Chi Minh city
 
Google_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Google_A_Behind_the_Scenes_Tour_-_Jeff_DeanGoogle_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Google_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Hiroshi Ono
 
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Cuneyt Goksu
 
Getting started with ibm tivoli workload scheduler v8.3 sg247237
Getting started with ibm tivoli workload scheduler v8.3 sg247237Getting started with ibm tivoli workload scheduler v8.3 sg247237
Getting started with ibm tivoli workload scheduler v8.3 sg247237
Banking at Ho Chi Minh city
 

Similaire à Profiling blueprints (20)

Simple asynchronous remote invocations for distributed real-time Java
Simple asynchronous remote invocations for distributed real-time JavaSimple asynchronous remote invocations for distributed real-time Java
Simple asynchronous remote invocations for distributed real-time Java
 
Letswift19-clean-architecture
Letswift19-clean-architectureLetswift19-clean-architecture
Letswift19-clean-architecture
 
Cloud computing_processing frameworks
Cloud computing_processing frameworksCloud computing_processing frameworks
Cloud computing_processing frameworks
 
Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)Rails Hardware (no conclusions!)
Rails Hardware (no conclusions!)
 
May2010 hex-core-opt
May2010 hex-core-optMay2010 hex-core-opt
May2010 hex-core-opt
 
กระบวนการเทคโนโลยีสารสนเทศ
กระบวนการเทคโนโลยีสารสนเทศกระบวนการเทคโนโลยีสารสนเทศ
กระบวนการเทคโนโลยีสารสนเทศ
 
Climb – Chaining Operators - Report
Climb – Chaining Operators - ReportClimb – Chaining Operators - Report
Climb – Chaining Operators - Report
 
Sliderfns
SliderfnsSliderfns
Sliderfns
 
End to-end scheduling with ibm tivoli workload scheduler version 8.2 sg246624
End to-end scheduling with ibm tivoli workload scheduler version 8.2 sg246624End to-end scheduling with ibm tivoli workload scheduler version 8.2 sg246624
End to-end scheduling with ibm tivoli workload scheduler version 8.2 sg246624
 
Google_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Google_A_Behind_the_Scenes_Tour_-_Jeff_DeanGoogle_A_Behind_the_Scenes_Tour_-_Jeff_Dean
Google_A_Behind_the_Scenes_Tour_-_Jeff_Dean
 
Challenging Web-Scale Graph Analytics with Apache Spark with Xiangrui Meng
Challenging Web-Scale Graph Analytics with Apache Spark with Xiangrui MengChallenging Web-Scale Graph Analytics with Apache Spark with Xiangrui Meng
Challenging Web-Scale Graph Analytics with Apache Spark with Xiangrui Meng
 
Challenging Web-Scale Graph Analytics with Apache Spark
Challenging Web-Scale Graph Analytics with Apache SparkChallenging Web-Scale Graph Analytics with Apache Spark
Challenging Web-Scale Graph Analytics with Apache Spark
 
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
 
Getting started with ibm tivoli workload scheduler v8.3 sg247237
Getting started with ibm tivoli workload scheduler v8.3 sg247237Getting started with ibm tivoli workload scheduler v8.3 sg247237
Getting started with ibm tivoli workload scheduler v8.3 sg247237
 
Mapredtutorial
MapredtutorialMapredtutorial
Mapredtutorial
 
Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Next Generation Indexes For Big Data Engineering (ODSC East 2018)Next Generation Indexes For Big Data Engineering (ODSC East 2018)
Next Generation Indexes For Big Data Engineering (ODSC East 2018)
 
Python Control library
Python Control libraryPython Control library
Python Control library
 
What's new in Redis v3.2
What's new in Redis v3.2What's new in Redis v3.2
What's new in Redis v3.2
 
Openobject bi
Openobject biOpenobject bi
Openobject bi
 
Matheus Albuquerque "The best is yet to come: the Future of React"
Matheus Albuquerque "The best is yet to come: the Future of React"Matheus Albuquerque "The best is yet to come: the Future of React"
Matheus Albuquerque "The best is yet to come: the Future of React"
 

Plus de bergel

Roassal presentation
Roassal presentationRoassal presentation
Roassal presentation
bergel
 

Plus de bergel (10)

Building Neural Network Through Neuroevolution
Building Neural Network Through NeuroevolutionBuilding Neural Network Through Neuroevolution
Building Neural Network Through Neuroevolution
 
Roassal presentation
Roassal presentationRoassal presentation
Roassal presentation
 
2011 famoosr
2011 famoosr2011 famoosr
2011 famoosr
 
2011 ecoop
2011 ecoop2011 ecoop
2011 ecoop
 
Test beautycleanness
Test beautycleannessTest beautycleanness
Test beautycleanness
 
The Pharo Programming Language
The Pharo Programming LanguageThe Pharo Programming Language
The Pharo Programming Language
 
2008 Sccc Inheritance
2008 Sccc Inheritance2008 Sccc Inheritance
2008 Sccc Inheritance
 
Presentation of Traits
Presentation of TraitsPresentation of Traits
Presentation of Traits
 
2004 Esug Prototalk
2004 Esug Prototalk2004 Esug Prototalk
2004 Esug Prototalk
 
2005 Oopsla Classboxj
2005 Oopsla Classboxj2005 Oopsla Classboxj
2005 Oopsla Classboxj
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Profiling blueprints

  • 1. Visualizing Dynamic Metrics with Profiling Blueprints Alexandre Bergel, Romain Robbes, Walter Binder University of Chile University of Chile Lugano
  • 2. { { { { } } } } { } 2
  • 3. 1.4 { 5.2 { { } } { } 5.6 } { } 2.3 0.5 ... 3
  • 4. 1.4 { 5.2 } { 5.6 } { { } } } { } } } { 2.3 { } { } { { 0.5 ... Understanding why 4
  • 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. 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
  • 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
  • 14. Polymetric view can map up to 5 dimensions width property color height property property X property Y property [Lanza 2003] 14
  • 15. KaiProfiler viewProfiling: [ | view | view := MOViewRenderer new. view nodes: (1 to: 100) forEach: [:each | view nodes: (1 to: 100)]. view root applyLayout ] 15
  • 16. Structural blueprint legend for methods # executions (color) execution #different time receiver 16
  • 17. Structural blueprint bounds legend for methods # executions (color) execution #different time receiver 17
  • 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. 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. Detailed behavioral blueprint computeExtentHavingChildrenFor: MOGraphElement>> origin Calling #bounds bounds Called by #bounds shapeBoundsAt:ifPresent: 20
  • 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. 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. Upgrading MOGraphElement>>bounds A B C 23
  • 24. 43% speedup Upgrading MOGraphElement>>bounds A B C 24
  • 25. A Upgrading MOGraphElement>>bounds B 25
  • 26. B C A cached absoluteBounds ins A' C' B' C' 26
  • 27. B C A D cached make display:on: absoluteBounds call absoluteBounds instead of absoluteBoundsFor: A' C' B' C' 26
  • 28. B C D make display:on: call absoluteBounds instead of absoluteBoundsFor: C' B' C' 26
  • 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. 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. Implementation techniques Visualizations are generated using a scripting languages ... in Mondrian 29
  • 32. Implemented in Pharo Smalltalk dialect Dynamically typed language 30
  • 33. Conclusion Effective visualizations Smooth integration in the programming environment Implemented in Pharo 31
  • 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. 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. 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

Notes de l'éditeur

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