Multi dimensional profiling

554
-1

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
554
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Multi dimensional profiling

  1. 1. Multi-Dimensional Execution Profiling Alexandre Bergel University of Chile, Chile Saturday 13 November 2010
  2. 2. 22009 2009 Saturday 13 November 2010
  3. 3. 3 } { } { } { } { } { Saturday 13 November 2010
  4. 4. 4 } { } { } { } { } { 1.4 5.2 5.6 2.3 0.5 ... Saturday 13 November 2010
  5. 5. 5 } { } { } { } { } { } { } { } { } { } { 1.4 5.2 5.6 2.3 0.5 ... Understanding why Saturday 13 November 2010
  6. 6. 6 Saturday 13 November 2010
  7. 7. 7 Saturday 13 November 2010
  8. 8. 82010 2010 Saturday 13 November 2010
  9. 9. 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 9 Saturday 13 November 2010
  10. 10. 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] ----------------------------------------------- 10 Saturday 13 November 2010
  11. 11. YourKit 11 Saturday 13 November 2010
  12. 12. YourKit 12 Saturday 13 November 2010
  13. 13. JProfiler 13 Saturday 13 November 2010
  14. 14. JProfiler 14 Saturday 13 November 2010
  15. 15. JProfiler 15 Saturday 13 November 2010
  16. 16. Retrospective on profiling 16 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”? Saturday 13 November 2010
  17. 17. Roadmap 1.Polymetric views 2.Profiling Blueprint 3.Implementation 17 Saturday 13 November 2010
  18. 18. Polymetric view can map up to 5 dimensions width property height property color property X property Y property 18[Lanza 2003] Saturday 13 November 2010
  19. 19. 19 KaiProfiler viewProfiling: [ | view | ! view := MOViewRenderer new. ! view nodes: (1 to: 100) forEach: [:each | view nodes: (1 to: 100)]. ! view root applyLayout ! ] Saturday 13 November 2010
  20. 20. Structural blueprint legend for methods (color) #different receiver # executions execution time 20 Saturday 13 November 2010
  21. 21. Structural blueprint legend for methods (color) #different receiver # executions execution time bounds 21 Saturday 13 November 2010
  22. 22. Behavioral blueprint legend for methods gray = return self yellow = constant on return value # executions execution time m2 m1 invokes m2 and m3 m1 m3 22 Saturday 13 November 2010
  23. 23. Behavioral blueprint legend for methods gray = return self yellow = constant on return value # executions execution time m2 m1 invokes m2 and m3 m1 m3 bounds 23 Saturday 13 November 2010
  24. 24. Detailed behavioral blueprint MOGraphElement>> origin shapeBoundsAt:ifPresent: Called by #bounds Calling #bounds bounds computeExtentHavingChildrenFor: 24 Saturday 13 November 2010
  25. 25. 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 25 Saturday 13 November 2010
  26. 26. 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 26 Saturday 13 November 2010
  27. 27. A B C Upgrading MOGraphElement>>bounds 27 Saturday 13 November 2010
  28. 28. A B C Upgrading MOGraphElement>>bounds 43% speedup 28 Saturday 13 November 2010
  29. 29. B A Upgrading MOGraphElement>>bounds 29 Saturday 13 November 2010
  30. 30. A B C cached absoluteBounds ins A' C' B' C' 30 Saturday 13 November 2010
  31. 31. A B C D cached absoluteBounds make display:on: call absoluteBounds instead of absoluteBoundsFor: A' C' B' C' 30 Saturday 13 November 2010
  32. 32. B C D make display:on: call absoluteBounds instead of absoluteBoundsFor: C' B' C' 30 Saturday 13 November 2010
  33. 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 31 Saturday 13 November 2010
  34. 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 (the Spy framework) 32 Saturday 13 November 2010
  35. 35. Implementation techniques Visualizations are generated using a scripting languages ... in Mondrian 33 Saturday 13 November 2010
  36. 36. 34 Saturday 13 November 2010
  37. 37. 352011 2011 Saturday 13 November 2010
  38. 38. Behavioral blueprint legend for methods gray = return self yellow = constant on return value # executions execution time m2 m1 invokes m2 and m3 m1 m3 36 Saturday 13 November 2010
  39. 39. 37 0 100000000 200000000 300000000 400000000 0 10000 20000 30000 40000 times (ms) messagesends Counting messages instead of time sampling Saturday 13 November 2010
  40. 40. Counting messages: cache warming 38 0 7500 15000 22500 30000 0 10000 20000 30000 40000 times (ms) MR α,c Saturday 13 November 2010
  41. 41. Counting messages per methods 39 times (ms) number of message sends 0 2500000 5000000 7500000 10000000 0 75 150 225 300 Saturday 13 November 2010
  42. 42. 40 Differentiation profiling Saturday 13 November 2010
  43. 43. Test coverage 41 Saturday 13 November 2010
  44. 44. Memory blueprint 42 MetacelloProject>> currentVersion MetacelloProject>> sortedAndFilteredVersions Saturday 13 November 2010
  45. 45. A B C www.moosetechnology.org/tools/Spy Alexandre Bergel, Romain Robbes, Walter Binder Thanks to Mariano, Fabian, Felipe, ... abergel@dcc.uchile.cl 43 Saturday 13 November 2010

×