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

automated software testing to discover energy
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 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

slide-2
SLIDE 2

Context

2

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

Developer

slide-3
SLIDE 3

Overview

3

Tools and techniques to write energy-efficient software

Energy-aware Software Testing Energy-hungry Code Patterns Energy-aware Coding Guidelines

Desktop machines, handheld devices etc.

slide-4
SLIDE 4

Overview

4

Tools and techniques to write energy-efficient software

Energy-aware Software Testing Energy-hungry Code Patterns Energy-aware Coding Guidelines

Desktop machines, handheld devices etc.

Android Devices

slide-5
SLIDE 5

Smartphone Market

Billion Dollars 2013 2014 2015 2016 2017

$0.20 $0.80 $0.70 $2.30

Smartphone Sales Mobile App Testing Market Size

Data obtained from IDC, Gartner and ABI Research

slide-6
SLIDE 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
slide-7
SLIDE 7

Energy Inefficiency

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

slide-8
SLIDE 8

Energy Inefficiency

Resource acquired Resource first used

Suboptimal resource binding

Wasted Energy

Service started Never used

Vacuous background service

Wasted Energy

slide-9
SLIDE 9

A Broader Categorization

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

Device does not return to idle High energy consumption + low utilization

slide-10
SLIDE 10

Measurement

Our framework

LG Optimus smartphone Yokogawa Digital Power Meter

slide-11
SLIDE 11

Measurement

  • Measuring Energy/Utilization ratio for an application

Time

Energy/Utilization

App is not executing (PRE) App is executing events (EXC) Recovery (REC) Idle (POST)

slide-12
SLIDE 12

Energy Inefficiency

Time

Energy/Utilization

App is not executing (PRE) App is executing events (EXC) Recovery (REC) Idle (POST)

Comparable

slide-13
SLIDE 13

Energy Inefficiency

Time

Energy/Utilization

App is not executing (PRE) App is executing events (EXC) Recovery (REC) Idle (POST)

Time

Energy/Utilization Comparable Not Comparable Energy Bugs

slide-14
SLIDE 14

Energy Inefficiency

Time

Energy/Utilization

App is not executing (PRE) App is executing events (EXC) Recovery (REC) Idle (POST)

Normal behavior

slide-15
SLIDE 15

Energy Inefficiency

Time

Energy/Utilization

App is not executing (PRE) App is executing events (EXC) Recovery (REC) Idle (POST)

Normal behavior

Time

Energy/Utilization Abnormal

(high energy low utilization)

Energy Hotspots

slide-16
SLIDE 16

Test Generation

Detecting Energy Inefficiency Guiding to execute energy-inefficient scenarios

Our framework

slide-17
SLIDE 17

Test Generation

Detecting Energy Inefficiency Guiding to execute energy-inefficient scenarios

Our framework

slide-18
SLIDE 18

Measurement

LG Optimus smartphone Yokogawa Digital Power Meter

Send events Record Utilization Record Energy Trace

slide-19
SLIDE 19

Measurement

LG Optimus smartphone Yokogawa Digital Power Meter

Send events Record Utilization Record Energy Trace Global clock

slide-20
SLIDE 20

Utilization

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

slide-21
SLIDE 21

Detecting Energy Bugs

Time

Energy/Utilization

App is not executing (PRE) App is executing events (EXC) Recovery (REC) Idle (POST)

Time

Energy/Utilization Comparable Not Comparable

Statistical dis-similarity between PRE and POST

slide-22
SLIDE 22

Detecting Energy Hotspots

Time

Energy/Utilization

App is not executing (PRE) App is executing events (EXC) Recovery (REC) Idle (POST)

Normal behavior

Time

Energy/Utilization Abnormal

(high energy low utilization)

Detecting discords in time-series data

slide-23
SLIDE 23

Test Generation

Detecting Energy Inefficiency Guiding to execute energy-inefficient scenarios

Our framework

slide-24
SLIDE 24

Guided Exploration

  • Energy-inefficient execution
  • Which fragments are energy-inefficient?
  • What is an appropriate coverage metric?
slide-25
SLIDE 25

A Broader Categorization

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

Invoked via System Calls

slide-26
SLIDE 26

Test Generation

Detecting Energy Inefficiency Guiding to execute energy-inefficient scenarios

Our framework

Android App + System call pool Event flow graph Event trace database Guided exploration To smartphone

Event trace

slide-27
SLIDE 27

Test Generation

Android App + System call pool Event flow graph Event trace database Guided exploration To smartphone

Event trace

An ordering between trace T1 and T2

  • s1

s2 s3 s1 s2

T1 > T2

More system calls s1 s2 s3 s5 s6

T1 > T2

s1 s2

Buggy trace

Similarity with buggy trace s1 s2 s3 s5 s6

T1 < T2

Covering more system calls s1 s2

Executed trace

s4

slide-28
SLIDE 28

Evaluation

Travel/Transportation Photography/Media Lifestyle/Health Entertainment Books/News Puzzle Productivity Tools

Category of Android Apps Evaluated

slide-29
SLIDE 29

Summary of Evaluation

App Feasible traces Energy Bugs Energy Hotspots Type Reported before Aripuca 502 Yes No

Vacuous background service

No Montreal Transit 64 No Yes

Suboptimal resource binding and more

No Sensor Test 2800 Yes No

Immortality Bug

No 760 KFMB AM 26 Yes Yes

Vacuous background service, suboptimal resource binding

No

All Results are in the paper (10 energy bugs and 3 energy hotspots found

  • ut of 30 tested apps)
slide-30
SLIDE 30

Summary of Evaluation

App System call coverage Code coverage Lines of Code

Aagtl

100 21 11612

Android Battery Dog

100 17 463

Aripuca

100 15 4353

Kitchen Timer

100 30 1101

Montreal Transit

89 11 10925

NPR News

100 24 6513

OmniDroid

83 36 6130

Pedometer

100 56 849

Vanilla Music Player

86 20 4081

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

  • ver different OS
slide-31
SLIDE 31

Case Studies

Aripuca (Energy Bug)

Reason: Vacuous Background Service

Fix:

serviceConnection.getService().stopLocationUpdates(); serviceConnection.getService().stopSensorUpdates();

slide-32
SLIDE 32

Case Studies

Aripuca (Energy Bug)

Reason: Vacuous Background Service

slide-33
SLIDE 33

Case Studies

Montreal Transit (Energy hotspot for <5 sec)

Main Thread Location service Location service (for loading ads) User exits GPS released

Loading Ads

slide-34
SLIDE 34

Case Studies

Montreal Transit (Energy hotspot for <5 sec)

Main Thread Location service Location service (for loading ads) User exits GPS released

Loading Ads

Main Thread Location service Share location for loading ads User exits GPS released

Loading Ads by Asynchronous thread

slide-35
SLIDE 35

Case Studies

Montreal Transit (Energy hotspot for <5 sec) Montreal Transit (After fixing)

slide-36
SLIDE 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
slide-37
SLIDE 37

Open Problems

  • Event Flow Graph may require intelligent inputs
  • Games
  • Confirmation of bugs/hotspots require repeated

execution

  • Debugging and optimization is manual