35
Energy-Efficiency in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell) January 31, 2017

Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Embed Size (px)

Citation preview

Page 1: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Energy-Efficiency in Mobile Software

JuliaRubin(jointlywithDulingLai,JürgenCito,PhillipStanley-Marbell)

January31,2017

Page 2: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Mobile Applications

•  Morethan2billionsmartphonesinuse–  Morethandesktopcomputers–  Plussmartwatches,glasses,cameras,TVs,in-carnaviga=on,andmessaging

•  Morethan3millionmobileappsinofficialappstores–  …andmuchmoreappsinhundredsofalterna=vestores

•  ~2.3millionac=vemobiledevelopersworldwide–  760,000peopleinAsia–  680,000peopleinNorthAmerica–  680,000peopleinEurope

2[h@ps://blog.newrelic.com/2014/06/13/mobile-app-development-trends-worldwide-need-know/][DeveloperEconomicsQ32014]

Page 3: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Mobile Application Developers

Lackknowledge,tools,andincen=vestodealwith:

–  Security–  Privacy–  Energy-efficiency

3

Page 4: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

What Can Go Wrong?

4

Page 5: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

What Can Go Wrong?

5

Majorconsumersofenergy:Screen,WiFi,GPS,Sensors,Camera,CPU[Pathaketal.,EuroSys’12,Banerjeeetal.,FSE’14]

Page 6: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

6

Example App

GPS location used

Page 7: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

GPS location update started

GPS location used

7

Example App

21

Page 8: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

GPS location update started

GPS location used

8

Example App

21

Page 9: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

GPS location update started

GPS location used

9

Example App

21

1 47%moreenergy

Page 10: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Energy Bugs

Anerrorinthesystemthatcausesanunexpectedamountofhighenergyconsump=on

10 [Pathak et al., HotNets’11]

Page 11: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Energy Bugs and Hotspots

Anapplica=onconsumesanabnormallyhighamountofba^erypower…

•  …evenaQerithascompletedexecuSonàBug

•  …eventhoughtheu=liza=onofitshardwareresourcesislowàHotspot

11 [Banerjee et al., FSE’14]

Page 12: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

12 [Banerjee et al., FSE’14]

Page 13: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

13 [Banerjee et al., FSE’14]

Resources(e.g.,WiFi)thatarenotreleasedorthedevicecomponent(e.g.,screen,CPU)isleeinahigh-powerstateaeertheapplica=onhasfinishedexecu=on

Page 14: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

14 [Banerjee et al., FSE’14]

Afailuretoremoveaservice(e.g.,loca=onorsensorupdates),whichwillkeeponrepor=ngdataeventhoughnoapplica=onneedsit

Page 15: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

15 [Banerjee et al., FSE’14]

Respawninganapplica=onorservicewhentheapplica=onhasbeenclosedbytheuser

Page 16: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

16 [Banerjee et al., FSE’14]

Bindingresourcestooearlyorreleasingthemtoolate

Page 17: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

17 [Banerjee et al., FSE’14]

Sca^eredusageofcomponents(e.g.,screen,WiFi),whichcausestailenergyconsump=onwhencomponentisswitchedoff

Page 18: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

18 [Banerjee et al., FSE’14]

Fine-grainedinsteadofcoarse-grainupdates(e.g.,GPSvs.WiFibasedloca=on);unnecessarilyhighsamplingrateforaservice

Page 19: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

19 [Banerjee et al., FSE’14]

Repeatedlyexecu=ngpor=onoftheapplica=onevenifnotnecessary(e.g.,con=nuouslyaccessingunreachableserver)

Page 20: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

20

•  Pathaketal.,MobiSys’12:sta=canalysistofinddefini=ons(resourceacquisi=on)thatarenotkilled(released)

•  Guoetal.,ASE’13(Relda):buildsaFunc=onCallGraph(callbacksandresource-relatedopera=ons)tocheckwhichresourcesarenotreleased

Page 21: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

21

•  Liuetal.,PerCom’13(GreenDroid):calculatesu=liza=onra=obyusingdynamictaintanalysis

•  Banerjeeetal.,MobileSoQ’16:improvesbindingloca=onbymatchingdefectanddesignexpressions

Page 22: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

GPS location update started

GPS location used

22

Example App

21

1 47%moreenergy

Page 23: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

GPS location update started

GPS location used

23

Example App

21

1 47%moreenergy

2 visiblyslower

?

Page 24: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

QoS Considerations

“Forbestloca=onaccuracy,youmightchoosetostartlisteningforloca=onupdateswhenusersbegincrea<ngthecontentorevenwhentheapplica<onstarts,<…>”“Youmightneedtoconsiderhowlongatypicaltaskofcrea=ngthecontenttakesandjudgeifthisdura=onallowsforefficientcollec=onofaloca=ones=mate.”

[h^ps://developer.android.com/guide/topics/loca=on/strategies.html]

24

Page 25: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

25

•  Chenetal.,HotPower’13:prefetchingads;upper-boundis3.2%,hardtoachieve

•  Lietal.,ICSE’16:bundlessequen=alHTTPrequests,15%reduc=on

Page 26: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

26

Page 27: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Taxonomy of Energy Bugs and Hotspots

HardwareResources

ResourceLeak

Subop=malResourceBinding

Sleep-stateTransi=onHeuris=cs

WakelockBug

TailEnergyHotspot

BackgroundServices

VacuousBackgroundServices

ExpensiveBackgroundServices

Defec=veFunc=onality

ImmortalityBug

LoopBug

27

•  Citoetal.,ASE’16

Page 28: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Advertising and Analytics (A&A)

•  Atleast3third-partylibsinanapp[Rubinatal.,ASE’15]

•  Consume65%-75%ofenergy[Pathaketal.,EuroSys’12]

•  Morethan40%ofHTTPconnec=onsdonotcontributetouser-observablebehavior[Rubinatal.,ASE’15]–Analy=cs

•  Adver=singconsumes16%ofenergy(plus48%moreCPU=meand79%morenetworkdata)[Guietal.,ICSE’15]

28

Page 29: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

29

Page 30: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Main Idea

Automa=callyiden=fyrecurrentA&Arequestsandadapttheirfrequencytothecurrentba^erystate.

30

Page 31: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

31

Page 32: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Battery Aware Transformation Basedon•  ρ–periodoftherecurrentrequests•  b–ba^erystatusaddadelaybeforerecurrentA&Arequests

32

Linearadapta=on:

Lowpowermode(at20%ba^erystatus):

Page 33: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Savings – an Example

•  VLCDirect:videostreamplayer•  Onerecurrentrequest–every30sec•  Introduced100%delay–to60sec•  Runfor30mins•  5.8%reduc=oninenergyconsump=on

(16%upperbound)

33

Page 34: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Providing Incentives

•  Problem:applica=onsare“greedy”–  Donotconsiderotherapps–  Donotconsiderba^erystatus

•  Inplan:game-theore=calapproachformobileenergymarketplace–  priceenergyandbillapplica=onsfortheenergytheyuse

34

Page 35: Energy in Mobile - University College Londoncrest.cs.ucl.ac.uk/cow/50/slides/cow50_Rubin.pdf · in Mobile Software Julia Rubin (jointly with Duling Lai, Jürgen Cito, Phillip Stanley-Marbell)

Summary

35