SlideShare a Scribd company logo
Visualizing Dynamic
Metrics with Profiling
     Blueprints
Alexandre Bergel, Romain Robbes, Walter Binder
        University of Chile       University of
              Chile                Lugano
“software profiling is the investigation
of a program's behavior using
information gathered as the program
executes”
                             - Wikipedia




                                           2
{               {
    {                   {
                            }
        }
        }
            }       {       }




                                3
{               {
    {                   {
                            }
        }
        }
            }       {       }




                                4
1.4
{               {
    {                   {
                            }
        }
        }
            }       {       }




                                      5
1.4
{
                                5.2
                {
    {                   {
                            }
        }
        }
            }       {       }




                                      6
1.4
{
                                5.2
                {
    {
        }
        }
                        {
                            }   5.6
            }       {       }




                                      7
1.4
{
                                5.2
                {
    {
        }
        }
                        {
                            }   5.6
            }       {       }
                                2.3




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



                                      9
1.4
{
                                5.2             }
                {
                                5.6
                                                    }
    {                   {                                   }
                            }                             } {
        }
        }                                               } {

                                2.3
                                                        {
            }       {       }                                   {
                                                                    {


                                0.5
                                ...   Understanding why




                                                                        10
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
                                                                     11
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]
-----------------------------------------------
                                                                                 12
YourKit




          13
YourKit




          14
JProfiler




           15
JProfiler




           16
JProfiler




           17
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




                                                  18
Roadmap




1.Polymetric views
2.Profiling Blueprint
3.Implementation




                                 19
Polymetric view can map up to 5
               dimensions
                   width property



                       color         height
                     property       property
      X property


   Y
property




                                      [Lanza 2003]   20
KaiProfiler
  viewProfiling: [
    | view |
!   view := MOViewRenderer new.
!   view
      nodes: (1 to: 100)
      forEach: [:each |
        view nodes: (1 to: 100)].
!   view root applyLayout
! ]




                                    21
Structural blueprint




                  legend for methods
                                 # executions




                                     (color)
                    execution
                                   #different
                      time
                                    receiver




                                                22
Structural blueprint




bounds



                           legend for methods
                                          # executions




                                              (color)
                             execution
                                            #different
                               time
                                             receiver




                                                         23
Behavioral blueprint




              legend for methods
                             # executions


                                gray =
                                return      m1     m3
                                 self
                execution                           m1
                  time         yellow =           invokes
                               constant     m2   m2 and m3
                               on return
                                value
                                                             24
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
                                                                 25
Detailed behavioral blueprint

                       computeExtentHavingChildrenFor:




                                            MOGraphElement>>
                                                 origin

    Calling #bounds



                                       bounds




   Called by #bounds
                       shapeBoundsAt:ifPresent:



                                                               26
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


                                                           27
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


                                                           28
Upgrading
        MOGraphElement>>bounds


A

    B
                     C




                                 29
43%
speedup             Upgrading
              MOGraphElement>>bounds


      A

          B
                           C




                                       30
A




      Upgrading
MOGraphElement>>bounds




                             B




                                 31
B                  C
                      A




    cached
absoluteBounds
                                                 instea




                 A'

                                        C'



                                   B'




                              C'


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




                                                  33
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



                                                       34
Implementation techniques

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


 Limitation
   hash code collisions (problem in Pharo)

   need to do execute the code to profile twice (sampling and
  instrumentation)




                                                               35
Implemented in Pharo
Smalltalk dialect
Dynamically typed language




                             36
Conclusion




Effective visualizations
Smooth integration in the programming environment
Implemented in Pharo




                                                    37
Conclusion



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




                                                          38
Conclusion



Future work
  close integration in the programming environment

  dedicated visualization for comparison

  additional metrics, e.g., the number of executed bytecodes,
 memory usage




                                                                39
Visualizing Dynamic Metrics with Profiling
               Blueprints

 www.moosetechnology.org/tools/Spy




  A                        Alexandre Bergel, Romain Robbes,
                                     Walter Binder
           B

                   C




                                  abergel@dcc.uchile.cl
                                                              40

More Related Content

PDF
PDF
了解Oracle rac brain split resolution
PDF
Introduction into MySQL Query Tuning for Dev[Op]s
PDF
Preparse Query Rewrite Plugins
PDF
F-Script
PDF
Smartcard-Login into Gemstone
PDF
Smalltalk in Enterprise Applications
PDF
Pharo
了解Oracle rac brain split resolution
Introduction into MySQL Query Tuning for Dev[Op]s
Preparse Query Rewrite Plugins
F-Script
Smartcard-Login into Gemstone
Smalltalk in Enterprise Applications
Pharo

Similar to Visualizing Dynamic Metrics with Profiling Blueprints (20)

KEY
Profiling blueprints
DOCX
การผันวรรณยุกต์ ป.1
PDF
Powerpoint ประกอบการบรรยาย
PDF
Incremental statistics for partitioned tables in 11g by wwf from ebay COC
DOCX
กระบวนการเทคโนโลยีสารสนเทศ
PDF
Military pay raise history & projections 1976 2017
PDF
第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
PDF
Blind elephant black hat 2010 v2
PDF
How to write LaTeX package
PDF
Section 6 practice b
PDF
Las ม.2 ปีการศึกษา 2554
PDF
โครงการทันตสุขภาพคนพิการ สสจ.เชียงราย
PDF
Order of operations practice puzzle
PDF
Getting started with ibm tivoli workload scheduler v8.3 sg247237
PDF
Connor McDonald Partitioning
PPTX
Final project
PDF
14157565 embedded-programming
PDF
Quick Wins
PPTX
Computational Social Science, Lecture 05: Networks, Part I
PDF
MySQL Performance Schema in 20 Minutes
Profiling blueprints
การผันวรรณยุกต์ ป.1
Powerpoint ประกอบการบรรยาย
Incremental statistics for partitioned tables in 11g by wwf from ebay COC
กระบวนการเทคโนโลยีสารสนเทศ
Military pay raise history & projections 1976 2017
第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
Blind elephant black hat 2010 v2
How to write LaTeX package
Section 6 practice b
Las ม.2 ปีการศึกษา 2554
โครงการทันตสุขภาพคนพิการ สสจ.เชียงราย
Order of operations practice puzzle
Getting started with ibm tivoli workload scheduler v8.3 sg247237
Connor McDonald Partitioning
Final project
14157565 embedded-programming
Quick Wins
Computational Social Science, Lecture 05: Networks, Part I
MySQL Performance Schema in 20 Minutes
Ad

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Directing Generative AI for Pharo Documentation
PDF
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
PDF
Analysing Python Machine Learning Notebooks with Moose
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
PDF
An Analysis of Inline Method Refactoring
PDF
Identification of unnecessary object allocations using static escape analysis
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
PDF
Encoding for Objects Matters (IWST 2025)
PDF
Challenges of Transpiling Smalltalk to JavaScript
PDF
Immersive experiences: what Pharo users do!
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
PDF
Cavrois - an Organic Window Management (ESUG 2025)
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Micromaid: A simple Mermaid-like chart generator for Pharo
Directing Generative AI for Pharo Documentation
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
Analysing Python Machine Learning Notebooks with Moose
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
Package-Aware Approach for Repository-Level Code Completion in Pharo
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
An Analysis of Inline Method Refactoring
Identification of unnecessary object allocations using static escape analysis
Control flow-sensitive optimizations In the Druid Meta-Compiler
Clean Blocks (IWST 2025, Gdansk, Poland)
Encoding for Objects Matters (IWST 2025)
Challenges of Transpiling Smalltalk to JavaScript
Immersive experiences: what Pharo users do!
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
Cavrois - an Organic Window Management (ESUG 2025)
Ad

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation theory and applications.pdf
PDF
KodekX | Application Modernization Development
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Big Data Technologies - Introduction.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
A Presentation on Artificial Intelligence
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation theory and applications.pdf
KodekX | Application Modernization Development
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
MYSQL Presentation for SQL database connectivity
Big Data Technologies - Introduction.pptx
NewMind AI Monthly Chronicles - July 2025
A Presentation on Artificial Intelligence
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding

Visualizing Dynamic Metrics with Profiling Blueprints

  • 1. Visualizing Dynamic Metrics with Profiling Blueprints Alexandre Bergel, Romain Robbes, Walter Binder University of Chile University of Chile Lugano
  • 2. “software profiling is the investigation of a program's behavior using information gathered as the program executes” - Wikipedia 2
  • 3. { { { { } } } } { } 3
  • 4. { { { { } } } } { } 4
  • 5. 1.4 { { { { } } } } { } 5
  • 6. 1.4 { 5.2 { { { } } } } { } 6
  • 7. 1.4 { 5.2 { { } } { } 5.6 } { } 7
  • 8. 1.4 { 5.2 { { } } { } 5.6 } { } 2.3 8
  • 9. 1.4 { 5.2 { { } } { } 5.6 } { } 2.3 0.5 ... 9
  • 10. 1.4 { 5.2 } { 5.6 } { { } } } { } } } { 2.3 { } { } { { 0.5 ... Understanding why 10
  • 11. 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 11
  • 12. 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] ----------------------------------------------- 12
  • 13. YourKit 13
  • 14. YourKit 14
  • 18. 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 18
  • 20. Polymetric view can map up to 5 dimensions width property color height property property X property Y property [Lanza 2003] 20
  • 21. KaiProfiler viewProfiling: [ | view | ! view := MOViewRenderer new. ! view nodes: (1 to: 100) forEach: [:each | view nodes: (1 to: 100)]. ! view root applyLayout ! ] 21
  • 22. Structural blueprint legend for methods # executions (color) execution #different time receiver 22
  • 23. Structural blueprint bounds legend for methods # executions (color) execution #different time receiver 23
  • 24. Behavioral blueprint legend for methods # executions gray = return m1 m3 self execution m1 time yellow = invokes constant m2 m2 and m3 on return value 24
  • 25. 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 25
  • 26. Detailed behavioral blueprint computeExtentHavingChildrenFor: MOGraphElement>> origin Calling #bounds bounds Called by #bounds shapeBoundsAt:ifPresent: 26
  • 27. 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 27
  • 28. 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 28
  • 29. Upgrading MOGraphElement>>bounds A B C 29
  • 30. 43% speedup Upgrading MOGraphElement>>bounds A B C 30
  • 31. A Upgrading MOGraphElement>>bounds B 31
  • 32. B C A cached absoluteBounds instea A' C' B' C' 32
  • 33. 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) 33
  • 34. 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 34
  • 35. Implementation techniques Visualizations are generated using a scripting languages ... in Mondrian Limitation hash code collisions (problem in Pharo) need to do execute the code to profile twice (sampling and instrumentation) 35
  • 36. Implemented in Pharo Smalltalk dialect Dynamically typed language 36
  • 37. Conclusion Effective visualizations Smooth integration in the programming environment Implemented in Pharo 37
  • 38. Conclusion A number of bottlenecks were identified No general rule for pattern identification Visualizations are effective for identifying potential candidate for optimization 38
  • 39. Conclusion Future work close integration in the programming environment dedicated visualization for comparison additional metrics, e.g., the number of executed bytecodes, memory usage 39
  • 40. Visualizing Dynamic Metrics with Profiling Blueprints www.moosetechnology.org/tools/Spy A Alexandre Bergel, Romain Robbes, Walter Binder B C abergel@dcc.uchile.cl 40