Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU...

82
© 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Achieving All-Day Battery Life Knowing is half the battle Jon Andrews Core OS Soren Spies Core OS System Frameworks #WWDC15 Session 707

Transcript of Achieving All-Day Battery Life• Limit CPU performance ... The Battery Is for the User CPU and GPU...

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

© 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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