38
MobiCom, 25 Aug 2012 Empowering Developers to Estimate App Energy Consumption Radhika Mittal, UC Berkeley Aman Kansal & Ranveer Chandra, Microsoft Research

Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Empowering  Developers  to  Estimate  App  Energy  Consumption  

Radhika  Mittal,  UC  Berkeley  Aman  Kansal  &  Ranveer  Chandra,  Microsoft  Research  

Page 2: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

 

•  Phone’s  battery  life  is  critical  performance  and  user  experience  metric  

•  Apps  responsible  for  large  fraction  of  energy  drain  

•  Difficult  for  app  developers  to  estimate  energy  trade-­‐offs    

2  

Page 3: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Developer  wants  to  download  and  display  an  image.  Which  one  will  consume  less  energy?                What  tools  do  developer  have  to  make  the  right  decision?                  

Energy  Efficient  Apps    

3  

Image1  –  18kB   Image2  –  1MB  

Display  power  –  600mW    

Display  Power  –  350mW    

Communication  cost  –  2J    

Communication  cost  –  10J    

Page 4: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Ease  of  use  &  set-­‐up  costs  

Component  energy  break-­‐up  

Runs  in  emulator  

Repeatability   What-­‐if  analysis  

Measurement  using  Power  Meter  [Flinn  et  al]  

 

   

   

   

 

   

Software/Event  Profiling  based  power  

modeling  tools  [Pathak  et  al,  Dong  et  al]  

   

 

 

   

   

Tools  to  Estimate  App  Energy    

4  

✗   ✗   ✗   ✗   ✗  

✓   ✓   ✗   ✗   ✗  

Page 5: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

 

§  Enables  app  developers  to  estimate  energy  consumed  by  different  components  of    phone,  while  debugging  on  emulator  

 § Allows  what-­‐if  analysis  

Our  Approach:  WattsOn  

5  

Page 6: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Basic  Structure  of  WattsOn  

App  Developer’s  Code  

Debugging  on  emulator  (WattsOn  runs  in  the  

background)  

Energy  Breakdown  

Exploration  of  varying  parameters  like-­‐    •  network  quality  •  signal  strength  •  screen  brightness  •  mobile  operator    •  handset  

6  

Page 7: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Tools  to  Estimate  App  Energy    

7  

Ease  of  use  and  set-­‐up  costs  

Component  energy  break-­‐up  

Runs  in  emulator  

Repeatability   What-­‐if  analysis  

Measurement  using  Power  Meter  [Flinn  et  al]  

 

✗    

✗    

✗    

✗    

 

✗    

Software/Event  Profiling  based  power  

modeling  tools  [Pathak  et  al,  Dong  et  al]  

 

✓  

✓    

 

✗  

✗    

✗    

 WattsOn  

 

✓    

✓    

✓    

✓    

✓  

Page 8: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

WattsOn  Design  

Page 9: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Overview      

Test  Application  

Resource  Profiling  

Mobile  Phone  Emulator  

Hardware  Resources  

Resource  Scaling  

Resource  Profiling  

Power  Profiling  

Target  Mobile  Device  

Power  Model  Generation  

Energy  Calculation  

APP  ENERGY  CONSUMPTION  

Device  Manufacturer,  or  OS  

Provider  Labs  

Developer  Workstation  

9  

Page 10: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

WattsOn  Power  Modeling  Resource  Scaling  

Network  

Display  

CPU  

Page 11: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

•  Emulator  runs  on  PC  over  Broadband  Internet  •  Phone  uses  cellular  network  (3G,4G…)  

 •  Cellular  energy  consumption  varies  with  

•  Signal  Strength  •  Network  Quality  •  Mobile  Operator  •  3G  chipset  

Challenges  

11  

Page 12: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

TCP  server  was  setup  with  Packet  Sniffer  running  on  it  to  capture  the  packets  transmitted  to/from  a  3G  device  (phone,  chipset  dev.  board)  

 

 

Power  Modeling  

Windows  Phone  client  containing  Qualcomm  3G  

chipset    

Computer  client  connected  to  an  Ericsson  3G  chipset  and  

attenuator  12  

Power  Meter  

3G  Client  

3G  Chipset  

Attenuator  Power  Meter  

Page 13: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

13  

Normal conditions (AT&T) Congested network (daytime)

Weak signal (1-bar) Another MO (T-Mobile)

3 network states Losses interplay poorly with TCP

More power needed at weak signal

Observations  

Power consumed varies with MO

Page 14: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

 §  Trace  Stretching  –  

•  Inconsistency  with  other  resource  utilizations  which  depend  on  network  activities  

•  Effect  on  other  parameters  of  network  flow  not  captured  

We  perform  link  shaping  –  NEWT,  Linux  Traffic  Shaper…  

 

Resource  Scaling  

14  

Page 15: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Network  Emulation  

15  

Dev application in emulator

Layer 2.5 Traffic Shaper

WattsOn

Scaled Upload Downloaded Frames

3G Network Parameters

User

Kernel

TCP/IP

NIC Device Driver

Packet Sniffer

Set network conditions

Compute network energy

from models

Uploaded Frames Scaled Download

Sniffer Device Driver

Page 16: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Network  Accuracy  Testing  

Average  Error  -­‐  4.73%  across  all  tests  

16  

1  MB  download  

100  KB  download  

1  KB  download  

Page 17: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

WattsOn  

Power  Modeling  Resource  Scaling  

Network  

Display  

CPU  

Page 18: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

§  LCD  and  OLED  power  models  show  linear  and  additive  properties  

§  Most  mobile  devices  today  use  Active  Matrix  OLED  •  optimizes  power  by  adjusting  screen  brightness  

based  on  the  scene  displayed  •  additive  and  linear  properties  no  longer  applicable    

Challenges  

18  

Page 19: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Non-­‐linearity  at  high  magnitudes    

AMOLED  Observations  

19  

Dependency  on  color  

Dependency  on  other  pixels  

Page 20: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

§  Basic  linear  model  from  OLED  §  Power  optimizations  modeled  using  a  look-­‐up  table    

•  16×16×16  entries  (each  of  R,  G,  B  discretized  to  16  levels)  •  Measurement  done  when  color  occupies  entire  screen  

 

Power  Model  

20  

Pdisplay  =  β(s)  .  L(s)  +  (1  –  β(s))  .  O(s)    

Optimized  power  from  Lookup  table  

From  linear  OLED  model  

•  β(s)  -­‐    controls  the  fraction  of  screen  area  for  which  power  optimizations  matter  (based  on  color  thresholds)  

•  s  represents  the  screenshot  displayed  

Page 21: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

§  Display  model  depends  on  pixel  power  •  Number  of  pixels  in  emulator  screen  may  vary  

Resource  Scaling  

21  

Page 22: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Display  Accuracy  Testing  Testing  accuracy  with  simple  colors  

22  

Page 23: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Display  Accuracy  Testing  Testing  with  30  images  

23  

Page 24: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Display  Accuracy  Testing  Testing  sub-­‐sampling  of  pixels  for  optimization  

24  

Page 25: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

WattsOn  

Power  Modeling  Resource  Scaling  

Network  

Display  

CPU  

Page 26: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

§  Emulator  PC  has  much  faster  CPU  than  phone:  •  For  e.g.  100%  utilization  on  phone  with  1GHz  CPU  

maps  to  13.8%  utilization  2.7  GHz  Intel  Core-­‐2  Quad-­‐Core  processor  

•  Other  differences  like  cache  size,  front  side  bus  speed,  …  

§  Scaling  cannot  be  done  after  capturing  data:  •  CPU  speed  affects  activities  of  other  components  •  May  lead  to  imbalance  in  readings.  

Challenges  

26  

Page 27: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Restrict  the  number  of  processor  cycles  available  to  the  emulator  

CPU  Emulation  

WattsOn

Performance Monitor

Control Thread

Compute CPU energy

P  =  α × u    

COMPUTER  HARDWARE  

KERNEL  

DEVELOPER  APPLICATION  IN    

EMULATOR  

CPU  0  

…  

CPU  n  

Lower    priority    

Higher    priority    

27  

OS  APIs  (Affinity,  Priority)  

Page 28: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

CPU  Accuracy  Testing  

Average  Error  -­‐    9.73%  across  all  tests  

28  

Page 29: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Evaluation  of  WattsOn  

Page 30: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Browser  App  

Page 31: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Browser  App  

Average  Error:  4.64%    

Page 32: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

Case  Study  

Page 33: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

What’s  the  energy  overhead  for  desirable  app  features:    §  Portability  –  Hybrid  

(HTML5)  app  or  Native?  

§  Rich  Graphics  vs.  simplistic  icons  

§  Animation    

App  Design  Decisions  

Simple  icon  18KB  

Rich  graphics  138KB  

Animation  (90kB)  

33  

Page 34: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

App  Design  Decisions  

34  

Portability  and  rich  graphics  has  negligible  energy  overhead  

•  network  energy  consumption  dominated  by  tail  state  

0  

10  

20  

30  

40  

50  

60  

70  

80  

Simple  Icon   Rich  Graphics   Animation  

Energy

 (J)  

Display   CPU   Network  

Page 35: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

App  Design  Decisions  

35  

Display  consumes  major  fraction  of  energy  usage  •  avoiding  brighter  images  leads  to  significant  energy  savings  

0  

10  

20  

30  

40  

50  

60  

70  

80  

Simple  Icon   Rich  Graphics   Animation  

Energy

 (J)  

Display   CPU   Network  

Page 36: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

App  Design  Decisions  

36  

Including  animation  leads  to  higher  CPU  energy  consumption.  

0  

10  

20  

30  

40  

50  

60  

70  

80  

Simple  Icon   Rich  Graphics   Animation  

Energy

 (J)  

Display   CPU   Network  

Page 37: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

MobiCom,  25  Aug  2012    

§ WattsOn  –  lightweight  emulation  time  tool  for  developers  •  Not  biased  by  network  conditions  or  device  configuration  •  Enables  what-­‐if  analysis  •  Average  Energy  Error:  4%  -­‐  9%    

§  Future  Work  •  Power  model  for  sensors  e.g.  GPS,  accelerometers  •  Energy  debugging  by  linking  spikes  to  code  snippets    

Conclusion  

37  

Page 38: Empowering!Developers!to! EstimateAppEnergyConsumptionjxie1/mobicom12/slides/Mittal.pdfMobiCom,25(Aug(2012(! Empowering!Developers!to! EstimateAppEnergyConsumption Radhika!Mittal,UC!Berkeley!

Thank  you!!