input sensitive profiling
play

Input-Sensitive Profiling Emilio Coppa Camil Demetrescu Irene - PowerPoint PPT Presentation

Intro RMS Case study Alg. Implem. Experiments Input-Sensitive Profiling Emilio Coppa Camil Demetrescu Irene Finocchi June 11, 2012 PLDI 2012 1 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012 Intro RMS


  1. Intro RMS Case study Alg. Implem. Experiments Input-Sensitive Profiling Emilio Coppa Camil Demetrescu Irene Finocchi June 11, 2012 PLDI 2012 1 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  2. Intro RMS Case study Alg. Implem. Experiments Conventional profilers Drawbacks classical approach Conventional profilers Conventional profilers gather cumulative info over a whole execu- tion f b (n) f a (n) n n 0 n' = ⇒ No information about how single portions of the code scale as a function of input size 2 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  3. Intro RMS Case study Alg. Implem. Experiments Conventional profilers Drawbacks classical approach Drawbacks classical approach Often hard to extract portions of code from an application and analyze them separately Hard to collect real data about typical usage scenarios to be reproduced in experiments Miss cache effects due to interaction with the overall application Critical algorithmic code should be analyzed within the actual con- text of applications it is deployed in 3 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  4. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Our approach “Input-Sensitive” profiling: aggregating routine times by input sizes For each routine f, collect a tuple: < n i , c i , max i , min i , sum i , q i > for each distinct value of the input size, where: n i = estimate of an input size c i = # of times the routine is called on input size n i max i / min i = maximum and minimum costs required by any execution of f on input size n i sum i / q i = sum of the costs required by the executions of f on input size n i and the sum of the costs‘ squares 4 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  5. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples How to measure input size automatically? Input size ≈ Read Memory Size The read memory size (RMS) of the execution of a routine f is the number of distinct memory cells first accessed by f, or by a descendant of f in the call tree, with a read operation. 5 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  6. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example) void swap(int * a, int * b) { int temp = *a; *a = *b; *b = temp; } The function swap has RMS 2 because it reads (first access) objects *a and *b , and writes (first access) variable temp 6 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  7. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x read y read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  8. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x f read y read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  9. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x 1 x f read y read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  10. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 1 x f read y read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  11. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 1 x f read y g read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  12. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 1 x f read y 1 x g read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  13. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 1 x f read y y 2 x g read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  14. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 2 x z f read y y 3 x z g read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  15. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 2 x z w f read y y 3 x z w g read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  16. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 2 x z w f read y y 3 x z w g read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  17. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 2 x z w f read y y 3 x z w g read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  18. Intro RMS Case study Alg. Implem. Experiments Our approach Definition Examples Read Memory Size (Example 2) call f read x Accessed cells write y Fn RMS (first-read green) call g read x y 2 x z w f read y y 3 x z w g read z write w return read w return 7 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  19. Intro RMS Case study Alg. Implem. Experiments Case study: discovering asymptotic inefficiencies We discuss wf-0.41 , a simple word frequency counter included in the current development head of Linux Fedora (Fedora 17–Beefy Miracle). We profile wf with: gprof a traditional and well-known call graph execution profiler – http://www.gnu.org/software/binutils/ aprof asymptotic profiler our implementation of an input-sensitive profiler – http://code.google.com/p/aprof/ 8 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  20. Intro RMS Case study Alg. Implem. Experiments We discuss wf-0.41 : gprof vs aprof 1 MB 5 MB 9 MB gprof gprof gprof gprof gmon.out gmon.out gmon.out addword str_tolower 9 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  21. Intro RMS Case study Alg. Implem. Experiments We discuss wf-0.41 : gprof vs aprof 1 MB 5 MB 9 MB 1 KB gprof gprof gprof gprof aprof gmon.out gmon.out gmon.out wf.aprof str_tolower addword str_tolower addword 9 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  22. Intro RMS Case study Alg. Implem. Experiments Is there any bottleneck in str_tolower? void str_tolower(char* str) { int i; for (i = 0; i < strlen(str); i++) str[i] = wf_tolower(str[i]); } 10 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  23. Intro RMS Case study Alg. Implem. Experiments Is there any bottleneck in str_tolower? void str_tolower(char* str) { int i; for (i = 0; i < strlen(str); i++) str[i] = wf_tolower(str[i]); } 10 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  24. Intro RMS Case study Alg. Implem. Experiments Is there any bottleneck in str_tolower? void str_tolower(char* str) { int i; for (i = 0; i < strlen(str); i++) str[i] = wf_tolower(str[i]); } Why did gprof fail to reveal the quadratic trend of str_tolower ? 10 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

  25. Intro RMS Case study Alg. Implem. Experiments Short vs long words in gprof Input of str_tolower = single words of input text not the input text! 11 / 23 E. Coppa, C. Demetrescu, I. Finocchi Input-Sensitive Profiling, PLDI 2012

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend