automated software testing to discover energy
play

Automated Software Testing to Discover Energy Inefficiencies in - PowerPoint PPT Presentation

Automated Software Testing to Discover Energy Inefficiencies in Mobile Apps Sudipta Chattopadhyay Linkping University, Sweden Joint work with Abhijeet Banerjee, Lee Kee Chong and Abhik Roychoudhury National University of Singapore Context


  1. Automated Software Testing to Discover Energy Inefficiencies in Mobile Apps Sudipta Chattopadhyay Linköping University, Sweden Joint work with Abhijeet Banerjee, Lee Kee Chong and Abhik Roychoudhury National University of Singapore

  2. Context Developer Write energy-efficient � software Tools and Programming abstractions techniques Desktops, handheld devices etc. 2

  3. Overview Tools and techniques to write energy-efficient software Energy-aware � Energy-hungry � Energy-aware � Software Testing Code Patterns Coding Guidelines Desktop machines, handheld devices etc. 3

  4. Overview Tools and techniques to write energy-efficient software Energy-aware � Energy-hungry � Energy-aware � Software Testing Code Patterns Coding Guidelines Desktop machines, handheld devices etc. Android Devices 4

  5. Smartphone Market Smartphone Sales Mobile App Testing Market Size $2.30 Billion Dollars $0.80 $0.70 $0.20 2013 2014 2015 2016 2017 Data obtained from IDC, Gartner and ABI Research

  6. Energy Inefficiency • How do we quantify energy inefficiency? • High energy consumption, what is high? � • High energy consumption • High utilization of hardware components • Low utilization of hardware components • Ratio Energy/Utilization

  7. Energy Inefficiency Cause/Source Suboptimal resource Hardware components Resource leak binding Sleep state transition Wakelock bug Tail Energy hotspot Vacuous background Expensive Background Service service background service Defective Functionality Immortality bug Loop energy hotspot

  8. Energy Inefficiency Wasted Energy Resource Resource acquired first used Suboptimal resource binding Wasted Energy Service started Never used Vacuous background service

  9. A Broader Categorization Cause/Source Energy Bugs Energy Hotspots Suboptimal resource Hardware components Resource leak binding Sleep state transition Wakelock bug Tail Energy hotspot Vacuous background Expensive Background Service service background service Defective Functionality Immortality bug Loop energy hotspot Device does � High energy consumption � not return to idle + low utilization

  10. Measurement Yokogawa Digital Power Meter LG Optimus smartphone Our framework

  11. Measurement • Measuring Energy/Utilization ratio for an application Energy/Utilization Time App is not executing App is executing Recovery Idle (PRE) events (EXC) (REC) (POST)

  12. Energy Inefficiency Comparable Energy/Utilization Time App is not executing App is executing Recovery Idle (PRE) events (EXC) (REC) (POST)

  13. Energy Inefficiency Comparable Energy/Utilization Time Not Comparable Energy/Utilization Energy Bugs Time App is not executing App is executing Recovery Idle (PRE) events (EXC) (REC) (POST)

  14. Energy Inefficiency Normal behavior Energy/Utilization Time App is not executing App is executing Recovery Idle (PRE) events (EXC) (REC) (POST)

  15. Energy Inefficiency Normal behavior Energy/Utilization Time Energy/Utilization Abnormal � (high energy � low utilization) Energy Hotspots Time App is not executing App is executing Recovery Idle (PRE) events (EXC) (REC) (POST)

  16. Test Generation Our framework Detecting Guiding to execute Energy energy-inefficient Inefficiency scenarios

  17. Test Generation Our framework Detecting Guiding to execute Energy energy-inefficient Inefficiency scenarios

  18. Measurement Yokogawa Digital Power Meter Record Energy Trace LG Optimus smartphone Send events Record Utilization

  19. Measurement Yokogawa Digital Power Meter Record Energy Trace Global � LG Optimus clock smartphone Send events Record Utilization

  20. Utilization Energy consumption of different components is not even (GPS < CPU) 100% CPU does not consume same energy as GPS being on

  21. Detecting Energy Bugs Comparable Energy/Utilization Time Not Comparable Energy/Utilization Statistical � dis-similarity � between � Time PRE and POST App is not executing App is executing Recovery Idle (PRE) events (EXC) (REC) (POST)

  22. Detecting Energy Hotspots Normal behavior Energy/Utilization Time Energy/Utilization Abnormal � (high energy � Detecting � low utilization) discords in � time-series � Time data App is not executing App is executing Recovery Idle (PRE) events (EXC) (REC) (POST)

  23. Test Generation Our framework Detecting Guiding to execute Energy energy-inefficient Inefficiency scenarios

  24. Guided Exploration • Energy-inefficient execution • Which fragments are energy-inefficient? • What is an appropriate coverage metric?

  25. A Broader Categorization Cause/Source Energy Bugs Energy Hotspots Suboptimal resource Hardware components Resource leak binding Sleep state transition Wakelock bug Tail Energy hotspot Vacuous background Expensive Background Service service background service Defective Functionality Immortality bug Loop energy hotspot Invoked via System Calls

  26. Test Generation Our framework Detecting Guiding to execute Energy energy-inefficient Inefficiency scenarios Android App Event flow + graph System call pool Event Guided trace Event trace To smartphone exploration database

  27. Test Generation Android App Event flow + graph System call pool Event Guided trace Event trace To smartphone exploration database An ordering between trace T1 and T2 � Buggy Executed T1 < T2 T1 > T2 T1 > T2 trace trace � s1 s1 s5 s1 s1 s1 s5 s1 s2 s2 s6 s2 s2 s2 s6 s2 s3 s3 s4 s3 Similarity with buggy trace More system calls Covering more system calls

  28. Evaluation Travel/Transportation Photography/Media Lifestyle/Health Entertainment Books/News Puzzle Productivity Tools Category of Android Apps Evaluated

  29. Summary of Evaluation Feasible � Energy Energy � Reported � App Type traces Bugs Hotspots before Vacuous Aripuca 502 Yes No No background service Suboptimal Montreal resource 64 No Yes No Transit binding and more Sensor 2800 Yes No No Immortality Bug Test Vacuous 760 background 26 Yes Yes No service, suboptimal KFMB AM resource binding All Results are in the paper (10 energy bugs and 3 energy hotspots found out of 30 tested apps)

  30. Summary of Evaluation System call � Code � App Lines of Code coverage coverage 100 21 11612 Aagtl 100 17 463 Android Battery Dog 100 15 4353 Aripuca 100 30 1101 Kitchen Timer 89 11 10925 Montreal Transit 100 24 6513 NPR News 83 36 6130 OmniDroid 100 56 849 Pedometer 86 20 4081 Vanilla Music Player To cover all system calls, exploring only a small part of the program suffices A substantial portion of the code is used for provide user feedback, compatibility over different OS

  31. Case Studies Aripuca (Energy Bug) Reason: Vacuous Background Service serviceConnection.getService().stopLocationUpdates(); Fix: serviceConnection.getService().stopSensorUpdates();

  32. Case Studies Aripuca (Energy Bug) Reason: Vacuous Background Service

  33. Case Studies Montreal Transit (Energy hotspot for <5 sec) Loading Ads Location service User exits Main Thread Location service GPS released (for loading ads)

  34. Case Studies Montreal Transit (Energy hotspot for <5 sec) Loading Ads Location service User exits Main Thread Location service GPS released (for loading ads) Loading Ads by Asynchronous thread Share location User exits Main Thread Location service for loading ads GPS released

  35. Case Studies Montreal Transit (Energy hotspot for <5 sec) Montreal Transit (After fixing)

  36. Summary • Categorization of energy inefficiency • Energy bugs • Energy hotspots • A guided exploration of event traces • Targeting system call coverage • Evaluation with Android apps • Energy bugs and hotspots exist in several Android apps

  37. Open Problems • Event Flow Graph may require intelligent inputs • Games • Confirmation of bugs/hotspots require repeated execution • Debugging and optimization is manual

Recommend


More recommend