Presentation is loading. Please wait.

Presentation is loading. Please wait.

15-446 Networked Systems Practicum Lecture 18 – Energy Monitoring 1.

Similar presentations

Presentation on theme: "15-446 Networked Systems Practicum Lecture 18 – Energy Monitoring 1."— Presentation transcript:

1 Networked Systems Practicum Lecture 18 – Energy Monitoring 1

2 2

3 Adaptive Disk Spin-Down Monitors the spin-down threshold and adjusts it to keep a balance between energy consumption and unacceptable spin-ups. Wireless Communication Suspension Transport Layer Protocol (TLP) that conserves power by choosing short periods of time to suspend communications Collaboration between TLP and mobile host to enable queuing of data when communication is suspended Up to 83% communication power savings, resulting in overall savings of 6-9% in laptops and 40% mobile device 3

4 Energy-Aware Adaptation for Mobile Applications The idea is to modify the applications' behavior dynamically to conserve energy. According to the energy supply and demand a decision is made: Use less energy if energy is scarce Use more energy otherwise (better user experience) OS is monitoring the energy and guide the applications to yield a battery-life of interest 4

5 Energy Management in the Cinder Operating System Controlling energy allocation is crucial feature for mobile OS's Introduces abstraction of reserves and taps Modification of HiStar OS running on ARM processor (Android G1) Used to achieve 3 properties of control o Isolation o Delegation o Subdivision 5

6 Outline 6

7 Motivation Energy is a critical resource for mobile computing. Comprehensive approach to energy management should include OS and apps, not just hardware! PowerScope profiles the energy usage of applications. Exposes targets for optimizations. Quantifies benefits of improvements. Iterative development reduces energy usage. 7

8 PowerScope Design Overview Profile generation is a two-stage process. First stage: sample collection Digital multimeter samples power levels. Kernel instrumentation samples system activity. Second stage: off-line analysis Symbol tables and samples used to generate energy profile. 8

9 Stage 1: Sample Collection System Monitor samples system activity. Digital multimeter samples current levels. Energy Monitor stores current samples. Hardware interface correlates sampling. 9

10 Stage 2 Off-Line Analysis Generates profile of energy usage. Runs off-line to reduce overhead Attributes samples to specific processes and functions. 10

11 Sample Profile: Summary Elapsed Total Average Process Time (s) Energy (J) Power (W) /usr/odyssey/bin/xanim /usr/X11R6/bin/X /netbsd (kernel) Interrupts-WaveLAN /usr/odyssey/bin/odyssey Total

12 Sample Profile: Process Detail Elapsed Total Average Procedure Time (s) Energy (J) Power (W) _Dispatcher _IOMGR_CheckDiscript _sftp_DataArrived _rpc2_RecvPacket _ExaminePacket Total

13 Case Study: Adaptive Video Goals of case study: Can degradation significantly reduce energy use? Which degradations are most effective? Are there techniques which reduce energy use across all video qualities? Experimental Setup: Client: 75MHz 486 laptop Server: 200 MHz Pentium Pro Network: 900 MHz WaveLAN 13

14 Result of Lossy Compression Benefit of lossy compression: 13% energy reduction 14

15 Experiment: Display Size Reduction Compression does not reduce X server energy usage. Will reducing the display size help? Repeated experiment with two additional tracks: One each at highest and lowest compression. Halved the height and width of the video display. 15

16 Result of Reducing Display Size Cumulative benefit: 24% energy reduction 16

17 Effect of Power Management 94% of energy used to keep hardware in idle state. Network power reduction: Odyssey suspends network between RPCs. Standby mode saves 1.4 W, overhead 0.81 ms. Disk power management: Odyssey puts disk to sleep at start of playback. 17

18 Result of Power Management Overall result: 46% reduction in energy usage! 18

19 19

20 20

21 21

22 22

23 23

24 24

25 The Rise of Energy Bugs Single Symptom: Severe, Unexpected Battery Drain Apps Need Not Crash No Blue Screen Of Death Common Perception: Kill some apps to fix Courtesy: Pathak et al 25

26 Paradigm Shift in Power Management Desktop/Server/Laptop: Default ON CPU turned off when idle for long time Smartphones: Default OFF Smartphone OSes aggressively turn off Screen/CPU after brief user inactivity Helps increasing standby time period 26 Courtesy: Jindal et al

27 Consequences of Aggressive Sleeping Policy Background jobs User is not always touching phone 27 public void DoNetwork ( ) { } Sync_Over_Network ( ); //Sync state with remote server //Can take up to a minute Need a mechanism to explicitly keep components awake. Keep the screen on ! Courtesy: Jindal et al

28 Android API to Explicitly Keep Components Awake 28 PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wakelock= pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, null); APIComponent (s) PARTIAL_WAKE_LOCKCPU SCREEN_DIM_WAKE_LO CK CPU and Screen (DIM) SCREEN_BRIGHT_WAKE _LOCK CPU and Screen (Bright) Camera.startPreview() Camera.release() Camera Courtesy: Jindal et al

29 Android API to Explicitly Keep Components Awake (Cont’d) 29 public void DoNetwork ( ) { } wakelock.acquire ( ); //Don’t let CPU sleep till I say so wakelock.release ( ); //CPU is now free to sleep Sync_Over_Network ( ); //Sync state with remote server //Can take up to a minute Courtesy: Jindal et al

30 NoSleep Energy Bugs 30 An error in smartphone app, where a component is woken up, but not put to sleep ComponentImpact (Google Nexus) CPU50-60% battery in 12 hrs Screen100% battery in 4-6 hrs GPS100% battery in 3-5 hrs Courtesy: Jindal et al

31 Types of NoSleep Bugs 31 NoSleep Race Conditions NoSleep Code Paths NoSleep Dilations Courtesy: Jindal et al

32 public void DoNetwork ( ) { } try { } catch (SomeException e){ Print.Error ( e ); //Print Error for Debugging purposes } wakelock.acquire ( ); //Don’t let CPU sleep till I say so wakelock.release ( ); //CPU is now free to sleep (a) NoSleep CodePaths 32 Sync_Over_Network ( ); //Sync state with remote server //Can take upto a minute ;throws ;exception At least one path in program wakes up a component and does not put it to sleep Courtesy: Jindal et al

33 (b) NoSleep Race Condition (1) 33 Process Thread 1 Thread 2 Time Process Thread 1Thread 2 Time acquire release Courtesy: Jindal et al

34 public class WorkerThread { } while(true){ //Infinite Loop } (b) NoSleep Race Conditions (2) 34 public class MainThread { } wakelock.acquire ( ); //CPU Cant Sleep WorkerThread.start ();//start worker WorkerThread.interrupt();//stop worker wakelock.release ( ); //CPU can sleep now boolean KillFlag = false; //Kill Flag KillFlag = true; //Kill the worker thread if(KillFlag) break; //Exit NetSync(); //Critical Section Thread.Sleep (3 Mins);//Sleep for 3 mins wakelock.release ( ); //CPU can sleep wakelock.acquire ( ); //CPU Cant Sleep …… ……. Correct Execution Buggy Execution Courtesy: Jindal et al

35 (c) NoSleep Dilations 35 Components are eventually turned off but are kept on for unusually long duration of time public void onCreate( ) { } public long startNewTrack( ) {.. } +wakelock.acquire ( ) ; wakelock.acquire ( ) ; Courtesy: Jindal et al

36 Detecting NoSleep Bugs NoSleep Code Paths NoSleep Race Conditions Static Data Flow Analysis Reaching Definitions Data Flow Problem 36 Courtesy: Jindal et al

37 : {} : {d1, d2} : {d3, d4}: {d2, d5, d6} : {d2, d3, d4, d5, d6} Reaching Definitions Data Flow Problem 37 y = 3; x = 10; y = 11; if( y > 5 ) { x = 1; y = 2; } else { z = x; x = 4; } Problem Statement: For each point in the program, determine which definition of variable are reachable exit entryd0: y = 3 d1: x = 10 d2: y = 11 if (y>5) B0 d3: x = 1 d4: y = 2 d5: z = x d6: x = 4 B1B2 IN[B0] OUT[B0] OUT[B2] IN[B2] IN[B1] IN[exit] OUT[B1] OUT[entry] = {} Courtesy: Jindal et al

38 NoSleep Code Path DataFlow Analysis 38 try { } catch (SomeException e){ Print.Error ( e ); //Print Error for Debugging purposes } wakelock.acquire ( ); //Don’t let CPU sleep till I say so wakelock.release ( ); //CPU is now free to sleep Sync_Over_Network ( ); //Sync state with remote server //Can take upto a minute ;throws ;exception exit Entry d0: wakelock = 1; Sync_over_network() B0 d1: wakelock = 0;Print.error(e); B1 B2 exit Entry d0: wakelock.acquire(); Sync_over_network() B0 d1: wakelock. realease(); Print.Error(e) B1 B2 : {d0, d1}IN[exit] : {d1} : {d0} Apply reaching definitions to NoSleep CodePaths Courtesy: Jindal et al

Download ppt "15-446 Networked Systems Practicum Lecture 18 – Energy Monitoring 1."

Similar presentations

Ads by Google