![Page 1: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/1.jpg)
© 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
Achieving All-Day Battery LifeKnowing is half the battle
Jon Andrews Core OSSoren Spies Core OS
System Frameworks #WWDC15
Session 707
![Page 2: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/2.jpg)
All-Day Battery Life?
![Page 3: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/3.jpg)
What Users Expect
Computing Energy
OS Energy Improvements
Developers’ Role
Your Software (Soren)
![Page 4: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/4.jpg)
What Users ExpectAll-day battery life
Background User
7 a.m. 11 p.m.
commutenews email
lunch
commute
break
game
dinner
![Page 5: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/5.jpg)
What Users ExpectAll-day battery life
Background User
7 a.m. 11 p.m.dinner
low power ~ all day
lunch
![Page 6: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/6.jpg)
What Users ExpectLow power ~ all-day battery life
0
125
250
375
500
low power
7 a.m. 11 p.m.
![Page 7: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/7.jpg)
Computing EnergyFundamentals
Energy = power × time Less power = more time
Battery Life
Max
3D Game
Active
Idle (Screen On)
Audio
Standby
Hours50 100 150 200 250
![Page 8: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/8.jpg)
Computing EnergyFundamentals
Energy = power × timeMake your app more like idle
Battery Life
Max
3D Game
Active
Idle (Screen On)
Audio
Hours10 20 30 40 50
not all day
all day
![Page 9: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/9.jpg)
Computing EnergyTrends
Energy = power × timeDynamic range growing• iOS devices getting closer to MacBook
New products more power-efficient• Yet peak power increases
Battery Life
Max
3D Game
Active
Idle (Screen On)
Audio
Hours10 20 30 40 50
not all day
all day
![Page 10: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/10.jpg)
Computing EnergyFixed and dynamic costs
Energy = Power × Time
Time
Pow
er
App Launch
App Activities
App Backgrounded
App SuspendedDynamic
Fixed
![Page 11: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/11.jpg)
Computing EnergyStandby
Audio Location
CPU
GPU
Cellular
Idle
Active
Sleep
Inactive
WiFi
Display
RAM
![Page 12: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/12.jpg)
User idle
Audio Location
CPU
GPU
Cellular
Idle
Active
Sleep
Inactive
WiFi
Display
RAM
Computing Energy
![Page 13: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/13.jpg)
Battery Drain RateUser idle
Power vs. Time
low power = all day
![Page 14: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/14.jpg)
Battery Drain RateUser idle
Power vs. Time
low power = all day
![Page 15: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/15.jpg)
3D game
Audio Location
CPU
GPU
Cellular
Idle
Active
Sleep
Inactive
WiFi
Display
RAM
Computing Energy
![Page 16: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/16.jpg)
Battery Drain Rate3D game
Power vs. Time
low power ~ all day
![Page 17: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/17.jpg)
Battery Drain Rate3D game
Power vs. Time
low power ~ all day
![Page 18: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/18.jpg)
Energy Optimization Strategy
Do work lessDo work laterDo work efficiently
![Page 19: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/19.jpg)
iOS 9 Improvements
iOS battery life best-in-class• … our customers want better
iOS 9 is better on existing hardware• Up to one hour better battery life• iOS and system apps energy-optimized
![Page 20: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/20.jpg)
Like OS X Mavericks
Eliminated polling in apps, frameworks, drivers, kernelQuality of service (QoS) for CPU and IOTimer coalescing and rate limitingMore efficient CPU power management“Significant Energy” in battery menu
![Page 21: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/21.jpg)
iOS 9 Improvements
Focused on iPhoneImprove all iOS products
![Page 22: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/22.jpg)
iOS 9 ImprovementsDo less work
Optimized sleep timersIdle power• Reduce CPU wake-ups
Face-down detection• Don’t light the screen on notifications
![Page 23: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/23.jpg)
iOS 9 ImprovementsDo work later
Defer more work until plugged inDefer some networking until WiFiLeverage persistent connection API
![Page 24: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/24.jpg)
iOS 9 ImprovementsDo work efficiently
Optimized iOS networking stack for LTEOptimized power management Reduced cost of loggingMore numerics optimizations
![Page 25: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/25.jpg)
iOS 9 ImprovementsUser feedback
Per-app battery usageEnvironmental factorsIntelligent suggestions
![Page 26: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/26.jpg)
iOS 9 ImprovementsUser feedback
Per-app battery usageEnvironmental factorsIntelligent suggestions
New: Per-app screen and background time
![Page 27: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/27.jpg)
iOS 9 ImprovementsUser feedback
User-initiated Low Power Mode• Limit CPU performance• No Background App Refresh• No discretionary/background downloads• No mail fetch
![Page 28: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/28.jpg)
iOS 9 ImprovementsDeveloper feedback
iOS energy gauge in XcodeLocation instrument
![Page 29: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/29.jpg)
Developers’ RoleExample: Video playback
Full-screen video optimization• Reduce backlight• Adjust gamma to compensate
Overlay UI disablesPower delta is small, but videos often long
Video Playback
With Layer
Without Layer
hours2 4 6 8 10
![Page 30: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/30.jpg)
Developers’ RoleOS X
MacBook• Thermally constrained (no fan)• Works best with bursts• QoS is critical for responsivenessOptimize• Existing OS X gauge & instruments• Prioritize work with NSOperation/GCD
![Page 31: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/31.jpg)
Developers’ RoleUnderstanding
Energy = power × timeHardware has a large dynamic rangeLow power for all-day battery life
![Page 32: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/32.jpg)
Reducing Software EnergyYour code vs. users’ batteries
Soren Spies, Core OS
![Page 33: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/33.jpg)
The Battery Is for the User
CPU and GPU Energy
Achieving Low (Average) Power for All-Day Battery Life
iOS Energy Consumption
Energy-Aware Development
![Page 34: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/34.jpg)
The Battery Is for the UserStrategy
Do less work, less often• Eliminate polling, timers• Respond to user, then absolute idle
![Page 35: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/35.jpg)
The Battery Is for the UserStrategy
Do less work, less often• Eliminate polling, timers• Respond to user, then absolute idle
Do work later• Does the user need this NOW?
![Page 36: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/36.jpg)
The Battery Is for the UserStrategy
Do less work, less often• Eliminate polling, timers• Respond to user, then absolute idle
Do work later• Does the user need this NOW?
Do work efficiently• Batch work into user-driven bursts• Optimize power and time ~ lower energy
![Page 37: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/37.jpg)
The Battery Is for the UserStrategy
Do less work, less often• Eliminate polling, timers• Respond to user, then absolute idle All-day battery life
assumes ~10% loadDo work later• Does the user need this NOW?
Do work efficiently• Batch work into user-driven bursts• Optimize power and time ~ lower energy
![Page 38: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/38.jpg)
The Battery Is for the UserUser should control energy use
Power vs. Time
~5% Power = display on
![Page 39: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/39.jpg)
The Battery Is for the UserUser should control energy use
~10% Power = all day
Power vs. Time
~5% Power = display on
![Page 40: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/40.jpg)
CPU and GPU Energy
DisplayGPU (Mac)CPU (Mac)
Biggest consumers on OS X
low power = all day
Power vs. Time
![Page 41: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/41.jpg)
CPU and GPU Energy
DisplayGPU (Mac)CPU (Mac)
Biggest consumers on OS X
>10% average~ partial day
low power = all day
Power vs. Time
![Page 42: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/42.jpg)
Wake-ups are expensiveDisplayiOS CPUOS X CPUGPU
low power= all day
CPU and GPU Energy
Power vs. Time
![Page 43: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/43.jpg)
Faster = less energyPower vs. Time
naive
CPU and GPU Energy
![Page 44: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/44.jpg)
Faster = less energy
efficient
Power vs. Time
naive
CPU and GPU Energy
![Page 45: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/45.jpg)
Faster = less energy
efficient
Power vs. Time
parallelnaive
CPU and GPU Energy
![Page 46: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/46.jpg)
efficientparallel
Power vs. Time
OpenCL/GPU
Faster = less energy
naive
CPU and GPU Energy
![Page 47: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/47.jpg)
efficientparallel
Power vs. Time
OpenCL/GPU
Faster = less energy
naive
lowest power =highest cost
CPU and GPU Energy
![Page 48: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/48.jpg)
Power vs. Time
Why?
naive
CPU and GPU Energy
![Page 49: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/49.jpg)
Power vs. Time
Less time with fixed costs
fixed costs
naive
CPU and GPU Energy
![Page 50: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/50.jpg)
naiveefficientparallel
Power vs. Time
OpenCL/GPU
Less time with fixed costs
fixed costs
CPU and GPU Energy
![Page 51: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/51.jpg)
naive
Average powerCPU and GPU Energy
![Page 52: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/52.jpg)
naive
Average powerCPU and GPU Energy
![Page 53: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/53.jpg)
Average power
naive
Is it low? No!
low power= all day
CPU and GPU Energy
![Page 54: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/54.jpg)
naiveefficient
parallel
Is it low?
OpenCL/GPUlow power= all day
Average powerCPU and GPU Energy
![Page 55: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/55.jpg)
iOS Energy ConsumptionLow-hanging fruit
Networking• Beware high, fixed costs
Location• Don’t leave it leaking
Background operation• Don’t delay sleep
![Page 56: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/56.jpg)
iOS NetworkingHigh, fixed costs
low power = all dayoverhead overhead
Power vs. Time
![Page 57: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/57.jpg)
iOS NetworkingHigh, fixed costs
low power = all dayoverhead overhead
average > low= partial day
Power vs. Time
![Page 58: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/58.jpg)
iOS Networking
low power = all dayoverhead overhead
coalesce?
Power vs. Time
Batch work to minimize overhead
![Page 59: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/59.jpg)
iOS Networking
Power vs. Time
overheadcoalesced!
Batch work to minimize overhead
low power = all day
![Page 60: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/60.jpg)
iOS Networking
Power vs. Time
overheadcoalesced!
average < low= all-day!
Batch work to minimize overhead
low power = all day
![Page 61: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/61.jpg)
iOS NetworkingOptimization
Use network less• Design it down or out• Once a minute is a lot
![Page 62: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/62.jpg)
iOS NetworkingOptimization
Use network less• Design it down or out• Once a minute is a lot
Use network later• Can it wait?• Background update, NSURLSession
![Page 63: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/63.jpg)
iOS NetworkingOptimization
Use network less• Design it down or out• Once a minute is a lot
Use network later• Can it wait?• Background update, NSURLSession
Use network efficiently• Batch work• Use notifications…sparingly
![Page 64: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/64.jpg)
iOS LocationPrecision ~ power
DisplayiOS Location
precise
Power vs. Time
imprecise
background off
low power = all day
![Page 65: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/65.jpg)
iOS LocationOptimization
Use location less• Don’t call startUpdatingLocation() until needed • Call stopUpdatingLocation() as soon as possible
![Page 66: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/66.jpg)
iOS LocationOptimization
Use location less• Don’t call startUpdatingLocation() until needed • Call stopUpdatingLocation() as soon as possible
• For single-fix, iOS 9 introduce requestLocation() • locManager.allowsBackgroundLocationUpdates = false
![Page 67: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/67.jpg)
iOS LocationOptimization
Use location less• Don’t call startUpdatingLocation() until needed • Call stopUpdatingLocation() as soon as possible
• For single-fix, iOS 9 introduce requestLocation() • locManager.allowsBackgroundLocationUpdates = falseUse location efficiently• Lower accuracy = lower power• allowDeferredLocationUpdatesUntilTraveled:timeout:
![Page 68: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/68.jpg)
iOS Background OperationCut it out!
BackgroundNotification (UI)Notification (net)
Power vs. Time
low power= all dayEnergy not delivering
user benefit.
unseen notification
![Page 69: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/69.jpg)
iOS Background OperationOptimization
startBackgroundTask() keeps device awake• Only start for non-trivial user work
Call endBackgroundTask() • As soon as possible• In all cases
Delegate indeterminate networking to OS
![Page 70: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/70.jpg)
The Ideal AppUser-driven, fast, and idle
Power vs. Time
low power = all daylaunch idle! user
work!
idle!
![Page 71: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/71.jpg)
How Is My App Doing?
Xcode now highlights• CPU• Networking• Location• Background
Instruments supportCome to our next talk
![Page 72: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/72.jpg)
Think EnergyEveryday workflow
Design• Plan to work less/later/efficiently• User expectation given app function
![Page 73: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/73.jpg)
Think EnergyEveryday workflow
Design• Plan to work less/later/efficiently• User expectation given app function
Implementation• Yours, Apple’s, third-party code
![Page 74: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/74.jpg)
Think EnergyEveryday workflow
Design• Plan to work less/later/efficiently• User expectation given app function
Implementation• Yours, Apple’s, third-party code
Test• Verify correct behavior
![Page 75: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/75.jpg)
Additional OptimizationsDoing more with less
Careful background updatesNotifications – use PushKit, including VOIPDisplay brightness – leave to userDrawing – 2014 talk
Energy Guide!
![Page 76: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/76.jpg)
Energy = Power × TimeLow Power ~ All-day Battery
![Page 77: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/77.jpg)
Do Less WorkDo It Later
Do It Efficiently
![Page 78: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/78.jpg)
More Information
Documentation and VideosiOS Energy Guidehttp://developer.apple.com/go/?id=ios-energy-efficiency-guide
OS X Energy Guidehttp://developer.apple.com/library/mac/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/
Writing Energy Efficient Code, Parts 1 & 2 (2014)http://developer.apple.com/videos
![Page 79: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/79.jpg)
More Information
Technical SupportApple Developer Forumshttp://developer.apple.com/forums
Developer Technical Supporthttp://developer.apple.com/support/technical
General InquiriesPaul Danbold, Core OS [email protected]
![Page 80: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/80.jpg)
Related SessionsLearn more
Debugging Energy Issues Nob Hill Wednesday 10:00AM
Networking with NSURLSession Pacific Heights Thursday 9:00AM
Low Energy, High Performance:Compression and Accelerate Nob Hill Thursday 10:00AM
What's New in Core Location Pacific Heights Thursday 1:30PM
Advanced NSOperations Presidio Friday 9:00AM
Building Responsive and Efficient Apps with GCD Nob Hill Friday 10:00AM
Performance on iOS and watchOS Presidio Friday 11:00AM
![Page 81: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/81.jpg)
Related LabsWe’re here for you!
Power and Performance Lab Frameworks Lab B Wednesday 1:30PM
Networking Lab Frameworks Lab E Thursday 10:00AM
Core Location Lab Frameworks Lab A Thursday 2:30PM
Power and Performance Lab Frameworks Lab C Friday 12:00PM
Networking Lab Frameworks Lab B Friday 1:30PM
![Page 82: Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU Energy Achieving Low (Average) Power for All-Day Battery Life iOS Energy Consumption](https://reader034.vdocument.in/reader034/viewer/2022043007/5f93b156a56e5855d52f0f95/html5/thumbnails/82.jpg)