SlideShare ist ein Scribd-Unternehmen logo
1 von 46
Downloaden Sie, um offline zu lesen
android battery
 consumption
the what & how
   kumar rangarajan
introducing
   littleEye appInsight




CT scanner for your Android App
why should you care about battery
         consumption?
• #1 pain point of smart phones users.
• more visible on Android than in iOS
• unlike memory, you can never reclaim excess usage!
• no moore’s law for battery capacity
• improving battery capacity is an ongoing research
  activity, but no current solution
• even then keeping up with consumption would be
  difficult as apps get more powerful and resource
  hungry
we code... consumers suffer



             Bad battery life is a big
             problem for
              ‣ Users
              ‣ Developers
              ‣ Ad networks
              ‣ Smartphone manufacturers
why should you care about battery
         consumption?
• #1 pain point of smart phones users.
• more visible on Android world than in iOS
• unlike memory, you can never reclaim excess usage!
• no moore’s law for battery capacity
• improving battery capacity is an ongoing research
  activity, but no current solution
• even then keeping up with consumption would be
  difficult as apps get more powerful and resource
  hungry
why should you care about battery
         consumption?
• #1 pain point of smart phones users.
• more visible on Android world than in iOS
• unlike memory, you can never reclaim excess
  usage!
• no moore’s law for battery capacity
• improving battery capacity is an ongoing research activity,
  but no current solution
• even then keeping up with consumption would be
why should you care about battery
         consumption?
• #1 pain point of smart phones users.
• more visible on Android world than in iOS
• unlike memory, you can never reclaim excess usage!
• no moore’s law for battery capacity
• improving battery capacity is an ongoing research activity,
  but no current solution
• even then keeping up with consumption would be
  difficult as apps get more powerful and resource hungry
why should you care about battery
         consumption?
• #1 pain point of smart phones users.
• more visible on Android world than in iOS
• unlike memory, you can never reclaim excess usage!
• no moore’s law for battery capacity
• improving battery capacity is an ongoing
  research activity, but no current solution
• even then keeping up with consumption would be
  difficult as apps get more powerful and resource hungry
why should you care about battery
         consumption?
• #1 pain point of smart phones users.
• more visible on Android world than in iOS
• unlike memory, you can never reclaim excess usage!
• no moore’s law for battery capacity
• improving battery capacity is an ongoing research activity,
  but no current solution

• even then keeping up with consumption
  would be difficult as apps will get more
  powerful and resource hungry
what consumes power?




   originally published in Google IO by Jeff Sharkey
network activity
• EDGE consumes less power for a byte of data transfer,
  but is slow
• Wifi consumes more power on average, but can do
  job faster
• 3G consumes more power than Wifi, and typically
  slower than Wifi.
• 4G consumes more power than 3G, and depending on
  availability, faster than Wifi
                    4G > 3G > Wifi > 2G
what causes power consumption?
• four primary states -
    ‣ establishing connection or association
    ‣ maintaining association (idle)
    ‣ transmission (two or more sub states)
    ‣ tail state (pseudo state)

               Establish         Maintain          Transmit                 Tail
 Wifi              High              Low               Low               Low

  2G              Low               Low               Low               Low

  3G              Low               Low               High              High
       derived from http://people.cs.umass.edu/~arun/papers/TailEnder.pdf
more about states




time between state reduction = tail state
how apps can impact state

       number of duration
                             size of each time in high/
          data     between
                              operation     low state
       operations operations

                                             18 + 42
app1       3          18         1 mb/s
                                             seconds


                                              8 + 12
app2       3      0 (bundled)    1 mb/s
                                             seconds
relative power consumption




  Total Current Consumed for 1 minute

 app1     78mA
                    app1 consumes 3x app2
 app2     28mA
best practices for network
• prefetch data
  ‣ to avoid switching states frequently, try and read as much data as
    possible
  ‣ trade-off between too much pre-fetch and battery drain
  ‣ google recommends prefetching data that you will initiate in the
    next 2 to 5 minutes, and in the order of 1-5 MB size

• batch data
  ‣ do data send/receive in batches rather than on-demand
  ‣ eg: batch analytics information, rather than sending them as they
    are collected
best practices for network
• prefetch data
  ‣ to avoid switching states frequently, try and read as much data as
    possible
  ‣ trade-off between too much pre-fetch and battery drain
  ‣ google recommends prefetching data that you will initiate in the
    next 2 to 5 minutes, and in the order of 1-5 MB size

• batch data
  ‣ do data send/receive in batches rather than on-demand
  ‣ eg: batch analytics information, rather than sending them as they
    are collected
best practices for network
• detect network connection
  ‣ avoid connection attempts if no network is active

• avoid polling and use GCM when possible
  ‣ avoids multiple connections
  ‣ reduces the number of device state changes

• using inexact timers
  ‣ AlarmManager.setInexactRepeating()
  ‣ use ELAPSED_REALTIME instead of ELAPED_REALTIME_WAKEUP
best practices for network
• detect network connection
  ‣ avoid connection attempts if no network is active

• avoid polling and use GCM when possible
  ‣ avoids multiple connections
  ‣ reduces the number of device state changes

• using inexact timers
  ‣ AlarmManager.setInexactRepeating()
  ‣ use ELAPSED_REALTIME instead of ELAPED_REALTIME_WAKEUP
best practices for network
• detect network connection
  ‣ avoid connection attempts if no network is active

• avoid polling and use GCM when possible
  ‣ avoids multiple connections
  ‣ reduces the number of device state changes

• using inexact timers
  ‣ AlarmManager.setInexactRepeating()
  ‣ use ELAPSED_REALTIME instead of ELAPED_REALTIME_WAKEUP
best practices for network

• use caching
 ‣ avoid redundant downloads

• varying download pattern
 ‣ modify pattern based on connection type
 ‣ download more data per session on faster
   networks
   ❖   change the aggression of pre-fetch
best practices for network

• use caching
 ‣ avoid redundant downloads

• varying download pattern
 ‣ modify pattern based on connection type
 ‣ download more data per session on faster
   networks
   ❖   change the aggression of pre-fetch
other tips (from google)

• monitor charge level and state
• monitor and determine the docking state
 and type
• monitor the connectivity state
• manipulate broadcast receivers on-demand
other tips (from google)

• monitor charge level and state
• monitor and determine the docking state
 and type
• monitor the connectivity state
• manipulate broadcast receivers on-demand
other tips (from google)

• monitor charge level and state
• monitor and determine the docking state
 and type
• monitor the connectivity state
• manipulate broadcast receivers on-demand
other tips (from google)

• monitor charge level and state
• monitor and determine the docking state
 and type
• monitor the connectivity state
• manipulate broadcast receivers on-demand
if your audience has not gone
          to sleep yet
                &
       organizers have...
screen
• color matters!
  ‣ esp on OLED screens

• darker the color, lesser the
  consumption
• brightness levels have more
  impact
  ‣ refer to - http://stackoverflow.com/
                                             Chameleon: Color Transformation on OLED Displays
    questions/5032588/cant-apply-system-
    screen-brightness-programmatically-in-
    android
  ‣ programmatically reduce brightness if
    its suits your app/activity
screen
• color matters!
  ‣ esp on OLED screens

• darker the color, lesser the
  consumption
• brightness levels have more
  impact
  ‣ refer to - http://stackoverflow.com/
                                             Chameleon: Color Transformation on OLED Displays
    questions/5032588/cant-apply-system-
    screen-brightness-programmatically-in-
    android
  ‣ programmatically reduce brightness if
    its suits your app/activity
screen
• color matters!
  ‣ esp on OLED screens

• darker the color, lesser the
  consumption
• brightness levels have more
  impact
  ‣ refer to - http://stackoverflow.com/
                                             Chameleon: Color Transformation on OLED Displays
    questions/5032588/cant-apply-system-
    screen-brightness-programmatically-in-
    android
  ‣ programmatically reduce brightness if
    its suits your app/activity
cpu
• typically runs on various
  frequencies
• frequency transition controlled
  by governor policy installed
• same concept as on linux based
  PCs, but typically more
  aggressive
• system drops down to ‘deep
  sleep’ as much as it can
• frequencies are scaled based of
  usage                             (C) CPUspy
cpu
• typically runs on various
  frequencies
• frequency transition controlled
  by governor policy installed
• same concept as on linux based
  PCs, but typically more
  aggressive
• system drops down to ‘deep
  sleep’ as much as it can
• frequencies are scaled based of
  usage                             (C) CPUspy
cpu
• typically runs on various
  frequencies
• frequency transition controlled
  by governor policy installed
• same concept as on linux based
  PCs, but typically more
  aggressive
• system drops down to ‘deep
  sleep’ as much as it can
• frequencies are scaled based of
  usage                             (C) CPUspy
cpu
• typically runs on various
  frequencies
• frequency transition controlled
  by governor policy installed
• same concept as on linux based
  PCs, but typically more
  aggressive
• system drops down to ‘deep
  sleep’ as much as it can
• frequencies are scaled based of
  usage                             (C) CPUspy
cpu
• typically runs on various
  frequencies
• frequency transition controlled
  by governor policy installed
• same concept as on linux based
  PCs, but typically more
  aggressive
• system drops down to ‘deep
  sleep’ as much as it can
• frequencies are scaled based of
  usage                             (C) CPUspy
best practices for cpu
• wakelocks are your friend, but your users
  worst nightmare!
• use them only if really needed and ensure
  they are removed as soon as possible
• use ‘android:keepScreenOn’ property in your
  manifest instead of doing it programmatically
• if possible, spread out your computationally
  intensive job
best practices for cpu
• wakelocks are your friend, but your users
  worst nightmare!
• use them only if really needed and ensure
  they are removed as soon as possible
• use ‘android:keepScreenOn’ property in your
  manifest instead of doing it programmatically
• if possible, spread out your computationally
  intensive job
best practices for cpu
• wakelocks are your friend, but your users
  worst nightmare!
• use them only if really needed and ensure
  they are removed as soon as possible
• use ‘android:keepScreenOn’ property in your
  manifest instead of doing it programmatically
• if possible, spread out your computationally
  intensive job
best practices for cpu
• wakelocks are your friend, but your users
  worst nightmare!
• use them only if really needed and ensure
  they are removed as soon as possible
• use ‘android:keepScreenOn’ property in your
  manifest instead of doing it programmatically
• if possible, spread out your computationally
  intensive job
best practices for cpu
• gpu typically consumes more power than cpu
   ‣ avoid floating point math where possible

• use gpu for data-parallel tasks like video/image
  processing
• use algorithms that consume less CPU cycle
   ‣ O(n log n) vs O(n 2) algorithms

  goal - keep the freq to the lowest
  level or reduce the number of cycles
best practices for cpu
• gpu typically consumes more power than cpu
   ‣ avoid floating point math where possible

• use gpu for data-parallel tasks like video/image
  processing
• use algorithms that consume less CPU cycle
   ‣ O(n log n) vs O(n 2) algorithms

  goal - keep the freq to the lowest
  level or reduce the number of cycles
best practices for cpu
• gpu typically consumes more power than cpu
   ‣ avoid floating point math where possible

• use gpu for data-parallel tasks like video/image
  processing
• use algorithms that consume less CPU cycle
   ‣ O(n log n) vs O(n 2) algorithms

  goal - keep the freq to the lowest
  level or reduce the number of cycles
best practices (others)

• gps is another very expensive component
   ‣ avoid fine grained locations if possible
• use power efficient SDKs
   ‣ eg: Location SDK from SkyhookWireless
best practices (others)

• gps is another very expensive component
   ‣ avoid fine grained locations if possible
• use power efficient SDKs
   ‣ eg: Location SDK from SkyhookWireless
references
1. http://developer.android.com/training/efficient-downloads/index.html
2. http://developer.android.com/training/monitoring-device-state/
   index.html
3. http://dl.google.com/io/2009/pres/W_0300_CodingforLife-
   BatteryLifeThatIs.pdf
4. http://people.cs.umass.edu/~arun/papers/TailEnder.pdf
5. http://chipdesignmag.com/lpd/absolute-power/2012/05/10/4g-lte-vs-3g/
6. http://thisweekinbatteries.blogspot.in/
7. http://www.ruf.rice.edu/~mobile/publications/dong10chameleon-
   demo.pdf
thank you

                 this presentation has been shared @
http://www.slideshare.net/littleeye/power-optimization-for-android-developers

                      http://www.littleeye.co/blog


                          kumar@littleeye.co

Weitere ähnliche Inhalte

Andere mochten auch

Energy consumption in smart phones huda
Energy consumption in smart phones hudaEnergy consumption in smart phones huda
Energy consumption in smart phones hudaNoor Huda
 
Energy efficiency of android
Energy efficiency of androidEnergy efficiency of android
Energy efficiency of androidlittleeye
 
LCA13: Memory Hotplug on Android
LCA13: Memory Hotplug on AndroidLCA13: Memory Hotplug on Android
LCA13: Memory Hotplug on AndroidLinaro
 
10 ways to improve your Android app performance
10 ways to improve your Android app performance10 ways to improve your Android app performance
10 ways to improve your Android app performanceBoris Farber
 
Learn about energy consumption and battery life on Android devices
Learn about energy consumption and battery life on Android devicesLearn about energy consumption and battery life on Android devices
Learn about energy consumption and battery life on Android devicesMarakana Inc.
 
State of Mobile Commerce 2014 (Sucharita Mulpuru)
State of Mobile Commerce 2014 (Sucharita Mulpuru)State of Mobile Commerce 2014 (Sucharita Mulpuru)
State of Mobile Commerce 2014 (Sucharita Mulpuru)Monetate
 
Android Performance Best Practices
Android Performance Best Practices Android Performance Best Practices
Android Performance Best Practices Amgad Muhammad
 
Ppt on World Of Smartphones
Ppt on World Of SmartphonesPpt on World Of Smartphones
Ppt on World Of SmartphonesPulkit Syal
 
50 Stunning Mobile Statistics
50 Stunning Mobile Statistics50 Stunning Mobile Statistics
50 Stunning Mobile StatisticsVala Afshar
 
Greenhouse Effect Power Point
Greenhouse Effect Power PointGreenhouse Effect Power Point
Greenhouse Effect Power Pointhilli1sm
 

Andere mochten auch (12)

Energy consumption in smart phones huda
Energy consumption in smart phones hudaEnergy consumption in smart phones huda
Energy consumption in smart phones huda
 
Energy efficiency of android
Energy efficiency of androidEnergy efficiency of android
Energy efficiency of android
 
LCA13: Memory Hotplug on Android
LCA13: Memory Hotplug on AndroidLCA13: Memory Hotplug on Android
LCA13: Memory Hotplug on Android
 
10 ways to improve your Android app performance
10 ways to improve your Android app performance10 ways to improve your Android app performance
10 ways to improve your Android app performance
 
Learn about energy consumption and battery life on Android devices
Learn about energy consumption and battery life on Android devicesLearn about energy consumption and battery life on Android devices
Learn about energy consumption and battery life on Android devices
 
State of Mobile Commerce 2014 (Sucharita Mulpuru)
State of Mobile Commerce 2014 (Sucharita Mulpuru)State of Mobile Commerce 2014 (Sucharita Mulpuru)
State of Mobile Commerce 2014 (Sucharita Mulpuru)
 
Android Performance Best Practices
Android Performance Best Practices Android Performance Best Practices
Android Performance Best Practices
 
The Greenhouse Effect
The Greenhouse EffectThe Greenhouse Effect
The Greenhouse Effect
 
Ppt on World Of Smartphones
Ppt on World Of SmartphonesPpt on World Of Smartphones
Ppt on World Of Smartphones
 
greenhouse effect
 greenhouse effect greenhouse effect
greenhouse effect
 
50 Stunning Mobile Statistics
50 Stunning Mobile Statistics50 Stunning Mobile Statistics
50 Stunning Mobile Statistics
 
Greenhouse Effect Power Point
Greenhouse Effect Power PointGreenhouse Effect Power Point
Greenhouse Effect Power Point
 

Kürzlich hochgeladen

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Power Optimization for Android developers

  • 1. android battery consumption the what & how kumar rangarajan
  • 2. introducing littleEye appInsight CT scanner for your Android App
  • 3. why should you care about battery consumption? • #1 pain point of smart phones users. • more visible on Android than in iOS • unlike memory, you can never reclaim excess usage! • no moore’s law for battery capacity • improving battery capacity is an ongoing research activity, but no current solution • even then keeping up with consumption would be difficult as apps get more powerful and resource hungry
  • 4. we code... consumers suffer Bad battery life is a big problem for ‣ Users ‣ Developers ‣ Ad networks ‣ Smartphone manufacturers
  • 5. why should you care about battery consumption? • #1 pain point of smart phones users. • more visible on Android world than in iOS • unlike memory, you can never reclaim excess usage! • no moore’s law for battery capacity • improving battery capacity is an ongoing research activity, but no current solution • even then keeping up with consumption would be difficult as apps get more powerful and resource hungry
  • 6. why should you care about battery consumption? • #1 pain point of smart phones users. • more visible on Android world than in iOS • unlike memory, you can never reclaim excess usage! • no moore’s law for battery capacity • improving battery capacity is an ongoing research activity, but no current solution • even then keeping up with consumption would be
  • 7. why should you care about battery consumption? • #1 pain point of smart phones users. • more visible on Android world than in iOS • unlike memory, you can never reclaim excess usage! • no moore’s law for battery capacity • improving battery capacity is an ongoing research activity, but no current solution • even then keeping up with consumption would be difficult as apps get more powerful and resource hungry
  • 8. why should you care about battery consumption? • #1 pain point of smart phones users. • more visible on Android world than in iOS • unlike memory, you can never reclaim excess usage! • no moore’s law for battery capacity • improving battery capacity is an ongoing research activity, but no current solution • even then keeping up with consumption would be difficult as apps get more powerful and resource hungry
  • 9. why should you care about battery consumption? • #1 pain point of smart phones users. • more visible on Android world than in iOS • unlike memory, you can never reclaim excess usage! • no moore’s law for battery capacity • improving battery capacity is an ongoing research activity, but no current solution • even then keeping up with consumption would be difficult as apps will get more powerful and resource hungry
  • 10. what consumes power? originally published in Google IO by Jeff Sharkey
  • 11. network activity • EDGE consumes less power for a byte of data transfer, but is slow • Wifi consumes more power on average, but can do job faster • 3G consumes more power than Wifi, and typically slower than Wifi. • 4G consumes more power than 3G, and depending on availability, faster than Wifi 4G > 3G > Wifi > 2G
  • 12. what causes power consumption? • four primary states - ‣ establishing connection or association ‣ maintaining association (idle) ‣ transmission (two or more sub states) ‣ tail state (pseudo state) Establish Maintain Transmit Tail Wifi High Low Low Low 2G Low Low Low Low 3G Low Low High High derived from http://people.cs.umass.edu/~arun/papers/TailEnder.pdf
  • 13. more about states time between state reduction = tail state
  • 14. how apps can impact state number of duration size of each time in high/ data between operation low state operations operations 18 + 42 app1 3 18 1 mb/s seconds 8 + 12 app2 3 0 (bundled) 1 mb/s seconds
  • 15. relative power consumption Total Current Consumed for 1 minute app1 78mA app1 consumes 3x app2 app2 28mA
  • 16. best practices for network • prefetch data ‣ to avoid switching states frequently, try and read as much data as possible ‣ trade-off between too much pre-fetch and battery drain ‣ google recommends prefetching data that you will initiate in the next 2 to 5 minutes, and in the order of 1-5 MB size • batch data ‣ do data send/receive in batches rather than on-demand ‣ eg: batch analytics information, rather than sending them as they are collected
  • 17. best practices for network • prefetch data ‣ to avoid switching states frequently, try and read as much data as possible ‣ trade-off between too much pre-fetch and battery drain ‣ google recommends prefetching data that you will initiate in the next 2 to 5 minutes, and in the order of 1-5 MB size • batch data ‣ do data send/receive in batches rather than on-demand ‣ eg: batch analytics information, rather than sending them as they are collected
  • 18. best practices for network • detect network connection ‣ avoid connection attempts if no network is active • avoid polling and use GCM when possible ‣ avoids multiple connections ‣ reduces the number of device state changes • using inexact timers ‣ AlarmManager.setInexactRepeating() ‣ use ELAPSED_REALTIME instead of ELAPED_REALTIME_WAKEUP
  • 19. best practices for network • detect network connection ‣ avoid connection attempts if no network is active • avoid polling and use GCM when possible ‣ avoids multiple connections ‣ reduces the number of device state changes • using inexact timers ‣ AlarmManager.setInexactRepeating() ‣ use ELAPSED_REALTIME instead of ELAPED_REALTIME_WAKEUP
  • 20. best practices for network • detect network connection ‣ avoid connection attempts if no network is active • avoid polling and use GCM when possible ‣ avoids multiple connections ‣ reduces the number of device state changes • using inexact timers ‣ AlarmManager.setInexactRepeating() ‣ use ELAPSED_REALTIME instead of ELAPED_REALTIME_WAKEUP
  • 21. best practices for network • use caching ‣ avoid redundant downloads • varying download pattern ‣ modify pattern based on connection type ‣ download more data per session on faster networks ❖ change the aggression of pre-fetch
  • 22. best practices for network • use caching ‣ avoid redundant downloads • varying download pattern ‣ modify pattern based on connection type ‣ download more data per session on faster networks ❖ change the aggression of pre-fetch
  • 23. other tips (from google) • monitor charge level and state • monitor and determine the docking state and type • monitor the connectivity state • manipulate broadcast receivers on-demand
  • 24. other tips (from google) • monitor charge level and state • monitor and determine the docking state and type • monitor the connectivity state • manipulate broadcast receivers on-demand
  • 25. other tips (from google) • monitor charge level and state • monitor and determine the docking state and type • monitor the connectivity state • manipulate broadcast receivers on-demand
  • 26. other tips (from google) • monitor charge level and state • monitor and determine the docking state and type • monitor the connectivity state • manipulate broadcast receivers on-demand
  • 27. if your audience has not gone to sleep yet & organizers have...
  • 28. screen • color matters! ‣ esp on OLED screens • darker the color, lesser the consumption • brightness levels have more impact ‣ refer to - http://stackoverflow.com/ Chameleon: Color Transformation on OLED Displays questions/5032588/cant-apply-system- screen-brightness-programmatically-in- android ‣ programmatically reduce brightness if its suits your app/activity
  • 29. screen • color matters! ‣ esp on OLED screens • darker the color, lesser the consumption • brightness levels have more impact ‣ refer to - http://stackoverflow.com/ Chameleon: Color Transformation on OLED Displays questions/5032588/cant-apply-system- screen-brightness-programmatically-in- android ‣ programmatically reduce brightness if its suits your app/activity
  • 30. screen • color matters! ‣ esp on OLED screens • darker the color, lesser the consumption • brightness levels have more impact ‣ refer to - http://stackoverflow.com/ Chameleon: Color Transformation on OLED Displays questions/5032588/cant-apply-system- screen-brightness-programmatically-in- android ‣ programmatically reduce brightness if its suits your app/activity
  • 31. cpu • typically runs on various frequencies • frequency transition controlled by governor policy installed • same concept as on linux based PCs, but typically more aggressive • system drops down to ‘deep sleep’ as much as it can • frequencies are scaled based of usage (C) CPUspy
  • 32. cpu • typically runs on various frequencies • frequency transition controlled by governor policy installed • same concept as on linux based PCs, but typically more aggressive • system drops down to ‘deep sleep’ as much as it can • frequencies are scaled based of usage (C) CPUspy
  • 33. cpu • typically runs on various frequencies • frequency transition controlled by governor policy installed • same concept as on linux based PCs, but typically more aggressive • system drops down to ‘deep sleep’ as much as it can • frequencies are scaled based of usage (C) CPUspy
  • 34. cpu • typically runs on various frequencies • frequency transition controlled by governor policy installed • same concept as on linux based PCs, but typically more aggressive • system drops down to ‘deep sleep’ as much as it can • frequencies are scaled based of usage (C) CPUspy
  • 35. cpu • typically runs on various frequencies • frequency transition controlled by governor policy installed • same concept as on linux based PCs, but typically more aggressive • system drops down to ‘deep sleep’ as much as it can • frequencies are scaled based of usage (C) CPUspy
  • 36. best practices for cpu • wakelocks are your friend, but your users worst nightmare! • use them only if really needed and ensure they are removed as soon as possible • use ‘android:keepScreenOn’ property in your manifest instead of doing it programmatically • if possible, spread out your computationally intensive job
  • 37. best practices for cpu • wakelocks are your friend, but your users worst nightmare! • use them only if really needed and ensure they are removed as soon as possible • use ‘android:keepScreenOn’ property in your manifest instead of doing it programmatically • if possible, spread out your computationally intensive job
  • 38. best practices for cpu • wakelocks are your friend, but your users worst nightmare! • use them only if really needed and ensure they are removed as soon as possible • use ‘android:keepScreenOn’ property in your manifest instead of doing it programmatically • if possible, spread out your computationally intensive job
  • 39. best practices for cpu • wakelocks are your friend, but your users worst nightmare! • use them only if really needed and ensure they are removed as soon as possible • use ‘android:keepScreenOn’ property in your manifest instead of doing it programmatically • if possible, spread out your computationally intensive job
  • 40. best practices for cpu • gpu typically consumes more power than cpu ‣ avoid floating point math where possible • use gpu for data-parallel tasks like video/image processing • use algorithms that consume less CPU cycle ‣ O(n log n) vs O(n 2) algorithms goal - keep the freq to the lowest level or reduce the number of cycles
  • 41. best practices for cpu • gpu typically consumes more power than cpu ‣ avoid floating point math where possible • use gpu for data-parallel tasks like video/image processing • use algorithms that consume less CPU cycle ‣ O(n log n) vs O(n 2) algorithms goal - keep the freq to the lowest level or reduce the number of cycles
  • 42. best practices for cpu • gpu typically consumes more power than cpu ‣ avoid floating point math where possible • use gpu for data-parallel tasks like video/image processing • use algorithms that consume less CPU cycle ‣ O(n log n) vs O(n 2) algorithms goal - keep the freq to the lowest level or reduce the number of cycles
  • 43. best practices (others) • gps is another very expensive component ‣ avoid fine grained locations if possible • use power efficient SDKs ‣ eg: Location SDK from SkyhookWireless
  • 44. best practices (others) • gps is another very expensive component ‣ avoid fine grained locations if possible • use power efficient SDKs ‣ eg: Location SDK from SkyhookWireless
  • 45. references 1. http://developer.android.com/training/efficient-downloads/index.html 2. http://developer.android.com/training/monitoring-device-state/ index.html 3. http://dl.google.com/io/2009/pres/W_0300_CodingforLife- BatteryLifeThatIs.pdf 4. http://people.cs.umass.edu/~arun/papers/TailEnder.pdf 5. http://chipdesignmag.com/lpd/absolute-power/2012/05/10/4g-lte-vs-3g/ 6. http://thisweekinbatteries.blogspot.in/ 7. http://www.ruf.rice.edu/~mobile/publications/dong10chameleon- demo.pdf
  • 46. thank you this presentation has been shared @ http://www.slideshare.net/littleeye/power-optimization-for-android-developers http://www.littleeye.co/blog kumar@littleeye.co

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n