![Page 1: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/1.jpg)
An Empirical Study of the Energy Consumption of Android Applications
Ding Li, Shuai Hao, Jiaping Gui, William G.J. Halfond
Department of Computer Science
University of Southern California
1
This work was supported in part by the National Science Foundation under Grant No. CCF-1321141 to the University of Southern California
![Page 2: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/2.jpg)
Battery Life Is a Critical Problem
2
Battery life is important to the user experience
![Page 3: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/3.jpg)
Battery Life Is a Critical Problem
3
Battery life is important to the user experience
Many apps drain the battery quickly
![Page 4: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/4.jpg)
Battery Life Is a Critical Problem
4
Battery life is important to the user experience
Many apps drain the battery quickly
How to create energy efficient apps?
![Page 5: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/5.jpg)
How to Create Energy Efficient Apps? Software Engineering Oriented Information
5
Which part is most energy consuming? Which part should be optimized?
![Page 6: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/6.jpg)
How to Create Energy Efficient Apps? Measurement of Energy Consumption
6
• Granularity
• Noise
• Isolation
![Page 7: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/7.jpg)
Other Works on Energy
• Energy estimation and measurement
– E.g., eLens [Hao et al. ICSE 2013]
– Do not directly provide information
• Techniques for energy optimization
– E.g., No-sleep bugs [Pathak et al. MobiSys 2012]
– Focus only on a particular problem
7
There are no empirical studies on large numbers of apps
![Page 8: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/8.jpg)
Our Study
• Source line level measurement study on 405 Android market apps
• 7 research questions on how energy is consumed in apps
– To provide software engineering practitioner oriented energy information
• 3 research questions on how to do energy measurement
8
![Page 9: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/9.jpg)
Research Questions: How Energy Is Consumed in Apps
9
App Energy
Idle State Energy Non-Idle State Energy
API Energy User Code Energy
Component Level
API Level Structure
Level Bytecode
Level
RQ 1
RQ 2
RQ 3
RQ 4 RQ 5 RQ 6 RQ 7
![Page 10: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/10.jpg)
Research Questions: How to Measure Energy
10
Proxy Measurement Handling Idle State
Energy Measurement
Granularity
RQ 8 RQ 9 RQ 10
![Page 11: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/11.jpg)
Experiment Protocol
• Hardware – Samsung Galaxy SII smart phone – With Android 4.3
• Energy measurement tool – Monsoon
• Source line level measurement – vLens [Li et al. ISSTA 2013]
• Automate the UI interaction – Monkey – 5 random events per second, 500 in total
• 405/412 apps with code coverage higher than 50% – No game apps
11
![Page 12: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/12.jpg)
Distribution of App Types
12
19%
19%
12% 11%
10%
8%
7%
7%
7%
Lifestyle & Productivity (LP)
Entertainment (En)
Travel & Transportation (TT)
Music & Media (MM)
Health & Medical (HM)
Sports & News (SN)
Photography (Ph)
Utilities & Tools (To)
Others
![Page 13: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/13.jpg)
RQ 1: How Much Energy Is Consumed by Individual Applications?
13
App Energy
Idle State Energy Non-Idle State Energy
API Energy User Code Energy
Component Level
API Level Structure
Level Bytecode
Level
RQ 1
![Page 14: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/14.jpg)
RQ 1: How Much Energy Is Consumed by Individual Applications?
14
Energy consumption of different applications
![Page 15: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/15.jpg)
RQ 1: How Much Energy Is Consumed by Individual Applications?
15
Energy consumption of different applications
![Page 16: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/16.jpg)
RQ 1: How Much Energy Is Consumed by Individual Applications?
16
Energy consumption of different applications
Average = 57,977 mJ, Standard deviation = 62,416 mJ
![Page 17: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/17.jpg)
RQ 1: How Much Energy Is Consumed by Individual Applications?
17
Energy consumption of different applications
Average energy 30% differ
![Page 18: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/18.jpg)
RQ 1: How Much Energy Is Consumed by Individual Applications?
18
Energy consumption of different applications
Energy differs for more than 100 times
![Page 19: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/19.jpg)
RQ 1: How Much Energy Is Consumed by Individual Applications?
19
Energy consumption of different applications
Variance within category is larger than across categories
![Page 20: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/20.jpg)
RQ 2: How Much Energy Is Consumed by the Idle State of An Application?
20
App Energy
Idle State Energy Non-Idle State Energy
API Energy User Code Energy
Component Level
API Level Structure
Level Bytecode
Level
RQ 2
![Page 21: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/21.jpg)
RQ 2: How Much Energy Is Consumed by the Idle State of An Application?
Wait for input, 37%
Sleep, 25%
Code running , 38%
Breakdown of app energy
21
![Page 22: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/22.jpg)
RQ 2: How Much Energy Is Consumed by the Idle State of An Application?
Wait for input, 37%
Sleep, 25%
Code running , 38%
Breakdown of app energy
22
Idle-states, no code is running
![Page 23: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/23.jpg)
RQ 2: How Much Energy Is Consumed by the Idle State of An Application?
Wait for input, 37%
Sleep, 25%
Code running , 38%
Breakdown of app energy
23
62% energy
Only optimizing code is insufficient, idle-state energy also needs to be optimized
![Page 24: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/24.jpg)
An Example of How to Reduce Idle State Energy
• Display energy could be saved in idle states
• Using energy efficient color designs
– Nyx [Li et al. ICSE 2014]
– Chameleon [Dong et.al Mobisys 2011]
24
![Page 25: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/25.jpg)
An Example of How to Reduce Idle State Energy
25
Save 40% energy [Li et al. ICSE 2014]
![Page 26: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/26.jpg)
RQ 3: Which Code Consumes More Energy: System APIs or Developer Written Code?
26
App Energy
Idle State Energy Non-Idle State Energy
API Energy User Code Energy
Component Level
API Level Structure
Level Bytecode
Level
RQ 3
![Page 27: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/27.jpg)
85%
2% 13%
API
Bytecode
Outliers
RQ 3: Which Code Consumes More Energy: System APIs or Developer Written Code?
27
Breakdown of non-idle energy
![Page 28: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/28.jpg)
85%
2% 13%
API
Bytecode
Outliers
RQ 3: Which Code Consumes More Energy: System APIs or Developer Written Code?
28
Breakdown of non-idle energy
System APIs from the Android SDK
![Page 29: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/29.jpg)
85%
2% 13%
API
Bytecode
Outliers
RQ 3: Which Code Consumes More Energy: System APIs or Developer Written Code?
29
Breakdown of non-idle energy
Normal user code
![Page 30: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/30.jpg)
85%
2% 13%
API
Bytecode
Outliers
RQ 3: Which Code Consumes More Energy: System APIs or Developer Written Code?
30
Breakdown of non-idle energy
Garbage collection and
thread switching
![Page 31: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/31.jpg)
85%
2% 13%
API
Bytecode
Outliers
RQ 3: Which Code Consumes More Energy: System APIs or Developer Written Code?
31
Breakdown of non-idle energy
Developer written code does not consume a significant amount of energy.
![Page 32: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/32.jpg)
RQ 4: How Much Energy Is Consumed by the Different Components of A Smartphone?
32
App Energy
Idle State Energy Non-Idle State Energy
API Energy User Code Energy
Component Level
API Level Structure
Level Bytecode
Level
RQ 4
![Page 33: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/33.jpg)
33
0 5 10 15 20 25 30 35 40 45
Media
Sensor
Location
Camera
Sqlite
IO
Net
UI
Percentage of non-idle energy (%)
RQ 4: How Much Energy Is Consumed by the Different Components of A Smartphone?
Average ratio of the energy consumption of a component to
the non-idle energy of apps
![Page 34: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/34.jpg)
34
0 5 10 15 20 25 30 35 40 45
Media
Sensor
Location
Camera
Sqlite
IO
Net
UI
Percentage of non-idle energy (%)
RQ 4: How Much Energy Is Consumed by the Different Components of A Smartphone?
Packages of APIs in SDK
Average ratio of the energy consumption of a component to
the non-idle energy of apps
![Page 35: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/35.jpg)
35
0 5 10 15 20 25 30 35 40 45
Media
Sensor
Location
Camera
Sqlite
IO
Net
UI
Percentage of non-idle energy (%)
RQ 4: How Much Energy Is Consumed by the Different Components of A Smartphone?
android.net.* and java.net.*.
Average ratio of the energy consumption of a component to
the non-idle energy of apps
![Page 36: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/36.jpg)
36
0 5 10 15 20 25 30 35 40 45
Media
Sensor
Location
Camera
Sqlite
IO
Net
UI
Percentage of non-idle energy (%)
RQ 4: How Much Energy Is Consumed by the Different Components of A Smartphone?
Calculated over the apps that used the network
Average ratio of the energy consumption of a component to
the non-idle energy of apps
![Page 37: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/37.jpg)
0 5 10 15 20 25 30 35 40 45
Media
Sensor
Location
Camera
Sqlite
IO
Net
UI
Percentage of non-idle energy (%)
37
RQ 4: How Much Energy Is Consumed by the Different Components of A Smartphone?
80%, HTTP requests
Average ratio of the energy consumption of a component to
the non-idle energy of apps
![Page 38: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/38.jpg)
0 5 10 15 20 25 30 35 40 45
Media
Sensor
Location
Camera
Sqlite
IO
Net
UI
Percentage of non-idle energy (%)
38
RQ 4: How Much Energy Is Consumed by the Different Components of A Smartphone?
These components may still dominate the energy of a particular app
Average ratio of the energy consumption of a component to
the non-idle energy of apps
![Page 39: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/39.jpg)
0 5 10 15 20 25 30 35 40 45
Media
Sensor
Location
Camera
Sqlite
IO
Net
UI
Percentage of non-idle energy (%)
39
RQ 4: How Much Energy Is Consumed by the Different Components of A Smartphone?
Average ratio of the energy consumption of a component to
the non-idle energy of an app Network is generally the most energy consuming component, but other components may also dominate the energy consumption of
an app
![Page 40: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/40.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
40
App Energy
Idle State Energy Non-Idle State Energy
API Energy User Code Energy
Component Level
API Level Structure
Level Bytecode
Level
RQ 5
![Page 41: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/41.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
• Distribution of energy consumption over APIs
– Across apps
– Within an app
• Similarity across apps of top 10 most energy consuming APIs
• Frequency of APIs being in the top 10 most energy consuming APIs
41
![Page 42: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/42.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
• Distribution of energy consumption over APIs
– Across apps
42
![Page 43: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/43.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
43
Average ratio of energy consumed by an API to the non-idle state energy across apps
![Page 44: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/44.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
44
98% of APIs
Average ratio of energy consumed by an API to the non-idle state energy across apps
![Page 45: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/45.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
45
HttpClient.execute
Average ratio of energy consumed by an API to the non-idle state energy across apps
![Page 46: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/46.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
46
Most APIs are not significant in energy consumption
Average ratio of energy consumed by an API to the non-idle state energy across apps
![Page 47: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/47.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
• Distribution of energy consumption over APIs
– Across apps
– Within an app
47
![Page 48: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/48.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
48
One app
The ratio of the energy consumption of an app’s top 10 most energy consuming APIs to its total API energy consumption
![Page 49: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/49.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
49
The ratio of the energy consumption of an app’s top 10 most energy consuming APIs to its total API energy consumption
For 91% of apps, the top 10 APIs consume more energy than all other APIs
Energy is concentrated in the top 10 most energy consuming APIs
![Page 50: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/50.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
• Distribution of energy consumption over APIs
– Across apps
– Within an app
• Similarity across apps of top 10 most energy consuming APIs
50
![Page 51: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/51.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
51
Top 10 most energy consuming
APIs of app B
Top 10 most energy consuming
APIs of app A
![Page 52: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/52.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
52
Top 10 most energy consuming
APIs of app B
Top 10 most energy consuming
APIs of app A
In general, the overlap is 1
There is very little similarity among the top 10 most energy consuming APIs
![Page 53: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/53.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
• Distribution of energy consumption over APIs
– Across apps
– Within an app
• Similarity across apps of top 10 most energy consuming APIs
• Frequency of APIs being in the top 10 most energy consuming APIs
53
![Page 54: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/54.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
54
Number of times each API is among the top 10 most energy consuming APIs for an app
![Page 55: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/55.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
55
Heavy tail
Number of times each API is among the top 10 most energy consuming APIs for an app
![Page 56: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/56.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
56
APIs to send HTTP requests
Number of times each API is among the top 10 most energy consuming APIs for an app
![Page 57: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/57.jpg)
RQ 5: Which APIs Are Significant in Terms of Energy Consumption?
57
HTTP requests are most likely to be most energy consuming
Number of times each API is among the top 10 most energy consuming APIs for an app APIs to send
HTTP requests
![Page 58: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/58.jpg)
RQ 6: How Much Energy Is Consumed by Code in Loops?
58
App Energy
Idle State Energy Non-Idle State Energy
API Energy User Code Energy
Component Level
API Level Structure
Level Bytecode
Level
RQ 6
![Page 59: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/59.jpg)
RQ 6: How Much Energy Is Consumed by Code in Loops?
59
Loops Without API
Loops With Normal API
Loops With HTTP API
Percentage of non-idle energy (%)
On average, loops consume 41% of non-idle state energy
Average ratio of energy consumption of loops to non-idle energy
![Page 60: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/60.jpg)
RQ 7: How Much Energy Is Consumed by the Different Types of Bytecodes
60
App Energy
Idle State Energy Non-Idle State Energy
API Energy User Code Energy
Component Level
API Level Structure
Level Bytecode
Level
RQ 7
![Page 61: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/61.jpg)
RQ 7: How Much Energy Is Consumed by the Different Types of Bytecodes
61
Data Manipulation
Grouped based on functionality
Most frequently used
Data manipulating instructions are the most energy consuming
Percentage of non-idle energy (%)
Average ratio of energy consumption of bytecodes to non-idle energy
![Page 62: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/62.jpg)
How Energy Is Consumed in Apps
• RQ 1: App energy varies significantly • RQ 2: Idle states consume more energy than code • RQ 3: APIs dominate the non-idle state energy • RQ 4: Network is the most energy consuming
component • RQ 5: Only a few APIs are significant in energy
consumption • RQ 6: Loops may consume a lot of energy • RQ 7: Data manipulation instructions are more
energy consuming than other bytecodes
62
![Page 63: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/63.jpg)
How to Measure the Energy
• RQ 8: Is time equal to energy? – On average, for 4.6 of the top 10 most energy
consuming APIs ranking by time is correct
• RQ 9: What granularity of measurement is sufficient? – Using millisecond level instead of nanosecond level
measurements can introduce a 64% error, on average
• RQ 10: Is it necessary to account for idle state energy? – Not accounting for idle state energy introduces a 36%
measurement error, on average
63
![Page 64: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/64.jpg)
Threats to Validity
• Generalizability (External Validity)
– 405 apps from 23 categories
– All have code coverage higher than 50%
• Accuracy of measurement (Internal Validity)
– We have 19% estimation error for bytecode energy
– Not large enough to affect our conclusions
• Bytecode mismatch (Construct Validity)
– We measured the energy of JVM bytecodes
– JVM bytecodes are matched to DVM bytecodes
64
![Page 65: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/65.jpg)
Summary
• A field study of 405 Android market apps
– With source line level measurement
– Apps from 23 categories
• We answer 10 research questions and provide actionable information to developers
65
![Page 66: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/66.jpg)
An Empirical Study of the Energy Consumption of Android Applications
Presented by
Ding Li
Department of Computer Science
University of Southern California
66
![Page 67: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/67.jpg)
[Li et al. ISSTA 2013]
67
sum
P*t
![Page 68: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/68.jpg)
[Li et al. ISSTA 2013]
68
Robust Regression
![Page 69: An Empirical Study of the Energy Consumption of …halfond/papers/li14icsme-slides.pdfAn Empirical Study of the Energy Consumption of Android Applications Ding Li, ... Health & Medical](https://reader031.vdocument.in/reader031/viewer/2022030905/5b48e6177f8b9aa4148dc5e3/html5/thumbnails/69.jpg)
Software Components and Hardware Components
69
UI
Net
Camera
Screen
CPU
4G net card
GPS sensors
Camera
Software components (APIs)
Energy from all hardware components