Energy Consumption Using Program Analysis Shuai Hao, Ding Li, - - PowerPoint PPT Presentation

energy consumption using
SMART_READER_LITE
LIVE PREVIEW

Energy Consumption Using Program Analysis Shuai Hao, Ding Li, - - PowerPoint PPT Presentation

Estimating Mobile Application Energy Consumption Using Program Analysis Shuai Hao, Ding Li, William G.J. Halfond, and Ramesh Govindan University of Southern California Motivation Smartphones are popular Batteries dont last that long


slide-1
SLIDE 1

Estimating Mobile Application Energy Consumption Using Program Analysis

Shuai Hao, Ding Li, William G.J. Halfond, and Ramesh Govindan University of Southern California

slide-2
SLIDE 2

Motivation

  • Smartphones are popular
  • Batteries don’t last that long
  • Many user complaints

2

Help app developers understand energy implications of their implementation choices

slide-3
SLIDE 3

Related Approaches

  • 1. Underlying hardware/OS improvements
  • 2. Cycle-accurate simulators
  • 3. Field measurements
  • 4. Whole program/method level feedback

3

slide-4
SLIDE 4

eLens – Our Approach

  • 1. Lightweight → no OS changes or

specialized hardware required

  • 2. Fine-grained → feedback at the source

line level

  • 3. Accurate → within 10% of ground truth
  • 4. Fast → estimates within minutes

4

Combine program analysis and per instruction cost modeling

slide-5
SLIDE 5

Overview of eLens

5

  • 1. Generate

workload

  • 2. Identify

corresponding executed paths

  • 3. Compute power

values for paths

  • 4. Annotate

source lines

1 2 3 4

slide-6
SLIDE 6

Generating the Workload

  • Use cases represent scenarios of interest

to the developers

  • Specified informally or formally
  • Our approach: run instrumented version of

the app and record runtime information

6

Convert use cases to paths

slide-7
SLIDE 7

Estimating a Path’s Energy

  • Cost functions (Ch) for each component (h)
  • Instruction’s energy cost is either:

– Path-independent: “fixed-cost” energy – Path-dependent: varies based on path

  • Cost functions provided by a Software

Environment Energy Profile (SEEP)

7

Energy = 𝑫𝒊 (𝒋)

𝒋 ∈ 𝒒𝒃𝒖𝒊 𝒊∈𝑰𝒃𝒔𝒆𝒙𝒃𝒔𝒇

slide-8
SLIDE 8

Software Environment Energy Profile

  • LEAP based profiling

– Runs Android 3.2 – Samples at 10KHz – Synchronization pulses – Multiple hardware components

8

Provides platform-specific energy parameters

  • Enables rapid analysis

for multiple platforms

slide-9
SLIDE 9

Instructions: Path-Independent

  • Energy varies by hardware component and

power state

  • Profiled on LEAP node

9

  • 1. Invokes/Returns
  • 2. Load/Stores
  • 3. Arithmetic/Logic
  • 4. Stack management
  • 5. Jumps/Branches
  • 6. Fixed-cost APIs

“Fixed-cost” instructions

slide-10
SLIDE 10

Instructions: Path-dependent

  • Four general categories:
  • Propagate certain types of information

along paths

10

  • 1. Array allocation
  • 2. Argument data
  • 3. Implementing class
  • 4. External data

Based on information from other instructions in the path

slide-11
SLIDE 11

Example Energy Calculation

11

ID Instruction Cost Functions (nJ) CPU RAM WiFi aload_0 1 1 .5 1 arraylength 1 1 .5 2 iconst_2 1 1 .5 3 if_icmpeq 14 2 1 .5 6 getstatic “Network.out” 2 1 .5 9 ldc “Usage…” 1 1 .5 11 invokevirtual “println” 20 10 10 14 return 1 1 .5

slide-12
SLIDE 12

Visualization

12

slide-13
SLIDE 13

Evaluation

RQ1: What is the accuracy of the energy estimates? RQ2: How much time is needed to estimate the energy consumption? RQ3: Is time profiling equivalent to energy estimation?

13

slide-14
SLIDE 14

Challenges to Obtain Ground Truth

  • 1. Apps compatible with LEAP node
  • 2. LEAP sampling interval
  • 3. Idle time dominates execution time
  • 4. Isolation of application energy

14

slide-15
SLIDE 15

Subject Applications

App Classes Methods Bytecodes Description BBC Reader 590 4,923 293,910 RSS Reader for BBC News Bubble Blaster II 932 6,060 398,437 Bubble blasting game Classic Alchemy 751 4,434 467,099 Science game Location 428 3,179 232,898 Provide location Skyfire 684 3,976 274,196 Web browser Textgram 632 5,315 244,940 Text editor

15

slide-16
SLIDE 16

Accuracy: App Level

16

eLens differs from Ground Truth, on average, 8.8%

Subject Applications

slide-17
SLIDE 17

Accuracy: Method Level

17

eLens differs from Ground Truth, on average, 7.1%

Method Names

slide-18
SLIDE 18

Accuracy: Hardware Components

18

Application Error Rate (%) CPU RAM WiFi GPS BBC Reader

  • 6.2

5.9

  • 6.8
  • Bubble Blaster II
  • 11.5

3.5

  • 11.6
  • Classic Alchemy
  • 7.9
  • 6.9
  • 4.4
  • Location
  • 7.8
  • 8.4
  • 8.1

Skyfire

  • 7.9

0.9

  • 8.4
  • Textgram

5.2 4.6 4.6

  • No more than 12% difference

from Ground Truth

slide-19
SLIDE 19

Runtime of eLens

19

97% 3%

Runtime Breakdown

Application Runtime (s) Instr. Est. BBC Reader 344 16 Bubble Blaster II 450 17 Classic Alchemy 886 17 Location 274 10 Skyfire 258 8 Textgram 269 6 Runtime ranged from 5 to 15 minutes

slide-20
SLIDE 20

Is Time Equal to Energy?

Compare methods’ time vs. energy

– Linear correlation?

→ Pearson == 0

– Ranking similarity?

→ Cosine similarity == .21

20

Strong indication of no linear relationship or ranking similarity.

slide-21
SLIDE 21

Conclusions

  • eLens → estimate energy consumption

– Uses program analysis and per-instruction cost modeling – Imposes minimal requirements on developer

  • Evaluation

– Accuracy was 8.8% at whole program level

21

slide-22
SLIDE 22

Thank you

22

slide-23
SLIDE 23

Case Study of Usefulness

23

slide-24
SLIDE 24

Working with Market Apps

24

APK JVM Bytecode JVM Bytecode

instrumentation

classes.dex eLens Lib manifest.xml resources libs manifest.xml classes.dex resources libs APK

slide-25
SLIDE 25

Bytecode Costs

25

slide-26
SLIDE 26

Time vs. Energy