SlideShare a Scribd company logo
Maximize App Performance
while Minimizing Battery Drain
Qualcomm Technologies, Inc
2
Agenda
The Challenge
1
Trepn Profiler
Deep Dive
2
QualcommĀ®
Snapdragonā„¢
Performance
Visualizer
3
Graphics &
Gaming
4
Qualcomm Snapdragon and Trepn are products of Qualcomm Technologies, Inc.
3
The Challenge
Rick Schwartz
Senior Product Manager
Qualcomm Technologies, Inc.
4
High end processor speeds increased from 1.5 GHz to 2.7 GHz over
the past 3 years
The number of cores have increased 3 of the past 4 years
Mobile displays are getting larger and higher in resolution
āˆ’ HD (1280x720) > FHD (1920x1080) > QHD (2560x1440)
Some mobile devices now designed to work 24/7
āˆ’ Tracking location
āˆ’ Listening for voice commands
āˆ’ Step counters track movement
A single mobile processor can replace several discrete chips
Mobile trends resulting in increased power consumption
Source: Qualcomm Technologies, Inc. data
5
Battery capacity hasn’t kept up
Processor specs for flagship Android devices by year
Power
(mAh)
3500
3000
2500
2000
1500
1000
2.5
2
1.5
1
0.5
0
2012 2013 2014
Frequency
(GHz)
Frequency
33% increase
in battery power
Battery
Source: Qualcomm Technologies, Inc. data
2012 – Samsung Galaxy S III - Snapdragon S4 SoC featuring a dual-core 1.5 GHz; 2100mAh
2013 – Samsung Galaxy S4 - Qualcomm Snapdragon 600 APQ8064AB quad-core 1.9 GHz; 2600 mAh
2014 – Samsung Galaxy S5 - Qualcomm Snapdragon 801 (8974) 2.5 GHz quad-core; 2800 mAh
80% increase
in processor speeds
0500
4000
6
Battery life is very important to consumers
Consumers rank phone battery life as the most important factor in their smartphone
buying decision. Q: For your next smartphone/mobile phone purchase, which of the
following features would drive your decision to select one phone over others?
Importance of Smartphone Features Among Smartphone Buyers1
38%
42%
44%
46%
46%
48%
52%
72%
Display / screen resolution
Memory / storage
4G or LTE connectivity
Screen / display type / quality
Screen / display size
Touchscreen
WiFi speed / quality
Battery life
1 Source: Qualcomm Brand Tracker, Market Research Group. United States, January 2014
Top 10 Smartphone Purchase Drivers2
Android vs. iOS Windowsvs.
Battery Life
Ease of Use
Operating System
Android, Symbian,
webOS, Windows Mobile
Touch Screen
Screen Size
56% 49% 53%
33% 39% 38%
37% 32% 40%
34% 34% 37%
37% 22% 34%
2 Source: IDC's ConsumerScape 360 by IDC Michael DeHart
7
ā€œHigh-riskā€ apps can waste power and mobile data
List of ā€œhigh riskā€ apps that drain the battery faster than normal typically highlighted
Unexpected data usage
2 to 5 times faster than normal
Over 70%
of these apps are chart toppers in Google Play
Some of these apps can cause the battery
to drain 2 to 5 times faster than normal
Some of these apps can cause unexpected
data usage (up to 2.2GB a month)
Source: Descriptions taken from Verizon’s High-risk App site. April 2014
8
Heavy battery usage is a top reason consumers uninstall apps
What causes users to delete an app?
76%
59%
71%
55% 53%
Freezes Slow
responsiveness
Crashes Heavy battery
usage
Too many ads
Source: Fierce Developer Survey – Exploring the reasons users complain about apps (Nov. 2012)
#1 #2 #3 #4 #5
9
Does your app consume
too much power?
10
1. Compare your app to the competition – Look at idle power and real world use cases
2. If you can measure it, you can act on it – Does code A or code B consumer more power?
How to: Accurately measure the power consumption of your app
ā€œProfile Appā€ or
ā€œProfile Systemā€
Launch Trepn, go to Settings,
and select the Battery Power
data point
Check ā€œAcquire Wakelock
while Profilingā€ keep your
processor awake
1 2 3
App #2 consumed 500%
more power than idle
and 53% more power
than a similar app
Device idle
(Screen off after 2 min)
App #1 consumed 3.2x
more power than idle
(Screen off after 2 min.)
Source: Trepn Profiler screenshots | Trepn is a product of Qualcomm Technologies, Inc.
11
What if your device doesn’t support battery power?
Here are some of the many options available
Android 5.0 Battery app GSam Battery Monitor Pro Power Tutor
12
1. Remove your USB cable – Trepn cannot display accurate power readings when your
mobile device is charging or connected to a computer. Tip: Use ADB over Wi-Fi
2. Make sure your device reports accurate battery power – Supported devices include :
Nexus 4, Nexus 5, Nexus 7, HTC One (2013), Sony Xperia ZL, HTC Droid DNA and more
3. Make sure your CPU stays awake – Check ā€œAcquire Wakelock while Profilingā€ in Settings
4. Minimize background processes – It’s not enough to close everything in Recent Apps. Go
to the Task manager and clear memory; Open the Apps manager, go to Running and close
all remaining unneeded apps, and stop all unneeded services
āˆ’ Pure Android devices are better for testing because they have fewer preinstalled apps and less
running in the background
āˆ’ Before closing unused apps: 1043mW. After closing unused apps : 726mW. A 30% difference!
Software Power Measurement Best Practices
13
5. Focus on what you’re measuring – Turn off everything that is not related to what you want
to measure (e.g., Screen when possible, Wi-Fi, Mobile networks, Location (GPS), Bluetooth,
Google Now, etc.).
6. Reduce overhead – Don’t use more data points than you need because this increases
system resource consumption. Make sure ā€œShow Per-Application Statis..ā€ is unchecked,
unless you need to see the mobile and Wi-Fi data transmitted. Turn off screen overlays
7. Minimize the impact of the screen – The screen is the biggest consumer of power. If you
don’t need the screen to be easily readable, you turn it off or set the screen timeout to a
short value (e.g., 1 minute)
8. Compare apples to apples – Don’t try to compare on-target measurements with off-target
(e.g. Monsoon) measurements
Software Power Measurement Best Practices, cont.
14
1. Go to developer.qualcomm.com and register. Log-in and download
Trepn Profiler under ā€˜Increase App Performance’
2. Install and launch Trepn and go to Settings
āˆ’ Under ā€˜General,’ check ā€˜Acquire Wakelock while profiling’
āˆ’ Under ā€˜Data Points,’ check ā€˜CPU2 Frequency’ and ā€˜CPU3 Frequency’ and
uncheck ā€˜Application State’
āˆ’ Go to ā€˜Overlays’ and add Graph overlays in the lower corners for ā€˜CPU2
Frequency’ and ā€˜CPU3 Frequency’
3. Go to Settings/General Save Preferences, type ā€˜Default’ preference
and touch Save
4. Touch Back, ā€˜Profile System’ and ā€˜Graph’
5. Touch the Back button and ā€˜Overlays’
6. Go to Notification bar and touch ā€˜Stop Profiling’
7. Save as .db, so the session can be analyzed later
Demo: Using Trepn to profile your mobile processor
15
Is this app CPU bound or GPU bound?
16
Is this app using all four of the CPU cores?
Source: Trepn screenshot of 3DMark Extreme benchmark
17
Trepn tracks the actual power consumed at a level of detail that
is unmatched by most other on-target profilers
Source: Screenshot of Trepn Profiler running GLBench
18
How much power is saved when playing a 4K video using the
hardware decode option?
Video playback using S/W decoder option Video playback using H/W decoder option
43% less power consumedAlmost 3x more CPU consumed load
19
Is this app using system resources efficiently?
Source: Trepn screenshot
20
Pros
āˆ’ Measures voltage, current and power
āˆ’ Very accurate
āˆ’ Doesn’t consume CPU cycles (or other system resources)
like on-target solutions
Cons
āˆ’ Must attach wires to the battery in your mobile device
āˆ’ Can be expensive ($770)
āˆ’ Can’t measure per-app or per-rail power
The pros and cons of off-target measurement
21
QualcommĀ® Snapdragonā„¢ MDP development hardware have sense resistors placed on
the following hardware rails:
āˆ’ CPU, Camera, Digital Core, Graphics, Internal Memory, LCD Backlight, SD Card and WLAN/BT
If you have a fixed resistance and know the voltage, you can easily determine the power
(P = V²/R). An EPM PSoC converts these analog voltages to digital, so Trepn Profiler can
display them
Measuring per-rail power consumption
Power Delta
Before
Photo Taken
Source: Trepn Profiler screenshots
Power Delta
After
Photo Taken
22
How to: Profile Your App Without Leaving Your IDE
Installing the Trepn plug-in for Eclipse
1. Launch Eclipse
2. Select Help Install New Software
3. Click Add … and Enter:
• Name – you may use any name, such as Trepn Plugin
• Location –
https://developer.qualcomm.com/docs/trepn/eclipse/
• Click OK
4. Select the Trepn Plugin checkbox and click Next
5. In Install Details, click Next
6. Review and accept the license agreement and click Finish:
• If you see a security warning regarding unsigned content,
click OK
• Installing dependencies may take a few minutes
7. After installation completes, restart Eclipse
8. Select Window Open Perspective Other
9. Select Trepn and click OK – Downloading additional files may
take a few minutes
23
Profiling in Eclipse
Starting and Stopping Profiling
1. Connect your device to the computer via USB
2. Confirm your device is listed as a connected device
3. In the Trepn Control pane (left side), click the green play
icon to start profiling:
• The Trepn APK will be installed on your device if
necessary
24
Trepn plug-in demo
Source: Trepn plug-in screen capture
25
Using Trepn to See What’s Happening Behind the Scenes
The Trepn plug-in shows what your phone is doing when it’s idle
Source: A portion of the Trepn plug-in screen
All 4 cores are
active here
GPU active here
250mA to 350mA of
power is used here Even though the cellular radio is idle, it still consumers up to 150mA of power
GPS active here
Wi-Fi
active here
26
Trepn shows how much data and CPU is used
Source: Trepn Profiler screenshots
Mobile data usage Wi-Fi data usage CPU usage by app
27
Playing Mobile Data Detective
Small changes can make a big difference
Source: Trepn plug-in screens
Mobile data transmitted before one setting is turned off
Mobile data transmitted after one setting is turned off
28
Trepn Shows Whether the Cellular Radio Is Being Used in an
Efficient Manner
Source: Trepn Profiler screenshots
29
A dormant cellular radio consumes
less than 10 mA
When data is sent or received, the
radio comes up and goes into an
active state, consuming 250-300mA
When not sending data, the radio
drops down to idle, but still
consumes about 150mA
After a timeout of 8 to 15 seconds,
the radio finally goes back to a
dormant state
Why this is a problem
Connected (Idle)
8-15 seconds
Current(mA)
Connected
(Active)
Time (seconds)
<10mA
250-300 mA
~150 mA
30
Connect less often – After you transmit data, the radio stays on for an additional 10 to 12 sec1
Push, don’t poll – Specify how often items are delivered1
Use analytics wisely1
āˆ’ Capture data locally and group transmissions to your server. Extend the time between transmissions
Offer ad-free versions of apps – Apps without ads connect to the network much less often
Don’t continuously scan1
āˆ’ Create timeouts appropriately when scanning for Wi-Fi networks or GPS signals
Don’t continuously stream – Download streams in chunks1
Offload to Wi-Fi – It uses significantly less battery than 3G or 4G1
Use the new JobScheduler APIs that are part of Android 5.02
Use Battery Historian to view wakelocks and mobile radio usage2
(http://github.com/google/batteryhistorian)
How to efficiently use your cellular radio and Wi-Fi network
1 Source: AT&T ā€œTips to Increase Battery Life Handoutā€ from AnDevCon 2013
2 Google I/O 2014 - Introduction to Project Volta by (Meghan Desai and Matthew Jay Williams)
31
The use JobScheduler APIs coalesces mobile radio activity
As a result, there is less overhead per mobile radio transmission
Source: Battery Historian Slide from Google I/O 2014 - Introduction to Project Volta by (Meghan Desai and Matthew Jay Williams)
Before
After
32
Bundling traffic can reduce overhead-to-data ratio
Source: The Smartphone Challenge: Signaling Congestion and Power Consumption - Gerardo Giaretta – Qualcomm Technologies Inc.
Ta Tb Tc
The amount of overhead to each data burst is high
Bundling data results in shorter connection time
and less overhead
Td
Td
Td < Ta+ Tb + Tc
Bundling or gating reduces the
number of times the device connects
to the network, which reduces
signaling and power consumption
Data from different apps
Overhead (Radio on duration)
Overhead transmission continues
(based on dormancy timer) before
terminal goes back to idle
33
The benefit of using your cellular radio more efficiently
Bundling data results in significant power savings
~9000mA
~5000mA
Nearly half the power!
300
150
10
2 minutes1 minute 3 minutes
2 minutes1 minute 3 minutes
300
150
10
Power(mA)Power(mA)
Source: Qualcomm Technologies, Inc. data
34
Trepn Profiler
Deep Dive
Eugene Kolinko
Senior Engineer
Qualcomm Technologies, Inc.
35
How to: Insert Markers in Your Code to Identify the Causes of
CPU, GPU and Power Spikes
Trepn correlates system events with your code
Step 1: Insert Application State markers in your code. Step 2: Track your app activity in Trepn.
36
Identifying the cause of power spikes in your code
Inserting markers in your code can help identify the cause of power spikes
Source: Trepn Profiler screenshots
37
How to: Using Application States to Analyze Automated Data
Using application states in automated tests to get average data
0
1000
2000
3000
4000
5000
6000
300 422 652 729 883 960 1036 1190 1267 1497 1574 1728 1958 2265
BatteryPower(mW)
Frequency (MHz)
Effect of Frequency Scaling on Battery Power
38
How to: Perform Automated Testing With Trepn
Trepn measures the effect of frequency scaling on battery power
39
Common Causes of Excess
Power Consumption
40
Common causes of excessive power consumption
Preventing the
processor (or other
hardware subsystems)
from going to sleep
1
Inefficient use of
the cellular radio
and Wi-Fi network
3
Keeping the
display lit too long
2
4
Taking too many
GPS location fixes
41
To test, unplug your device and run
it for at least 2-3 hours
A large number of short wakelocks
or wakeup triggers can have a
negative impact on battery usage
because a phone takes time to
wake and go back asleep
Does your app prevent the processor from going to sleep?
Using Wakelock Detector (WLD) to identify processor sleep problems (Android 4.3 and earlier)
CPU Wakelocks Wakeup Triggers
42
A Nexus 5 in standby gets almost one month of battery life -- yet most consumers get less
than one day
The reason: You trade two minutes of standby power every hour for 1 second of activity. With
50 apps, 100 minutes of standby power is consumed every hour
Why this is a big deal
Notes from Google’s Android Performance Primer at Google I/O (Intro to Project Volta)
Source: Slides from Google I/O 2014 - Introduction to Project Volta by (Meghan Desai and Matthew Jay Williams)
Google studied the power consumed for three typical use cases
43
Do not acquire PowerManager.Wakelocks unless you really need them
āˆ’ Device battery life will be significantly affected by the use of this API
Use the minimum levels needed
Be sure to release wakelocks as soon as possible
To keep the screen lit when your app is in the foreground,
use FLAG_KEEP_SCREEN_ON instead
Consider using AlarmManager in situations when you want to have your application code run
at a specific time. Beginning with KitKat, the OS will shift alarms to minimize wakeups and
battery usage.
For normal timeouts, it’s easier and more efficient to use Handler
How to avoid preventing your device from going to sleep
Expert advice how to use wakelocks more efficiently
Source: http://developer.android.com/reference/android/os/PowerManager.html#PARTIAL_WAKE_LOCK
44
The Wi-Fi radio will only turn off if no WifiLocks are held by any application
Before using a WifiLock, consider if your app requires Wi-Fi access,or could
function of the mobile network
Large file downloads should hold a WifiLock to ensure the download will complete
Using WifiLocks more efficiently
Here’s what Google says about the use of WifiLocks
Source: http://developer.android.com/reference/android/net/wifi/WifiManager.WifiLock.html
45
Make sure you don’t take a GPS fix when it’s not needed – AT&T’s ARO and Trepn plug-
in show when GPS fixes occur
Use coarse GPS fixes when possible, because they require much less power
Let LocationManager find the best provider for you
Have a timeout if you can’t find a satellite
Make the user aware when location tracking is active
Make it easy for users to disable location tracking without crippling their device
How to save power when using the GPS
46
Benefits of offloading to a DSP
Power savings running FastCVā„¢ facial detection to run on a DSP instead of CPU
FastCV is a product of Qualcomm Technologies, Inc.
47
Android 4.4 adds platform support for audio tunneling to a digital signal processor (DSP) in
the device chipset, waking the application processor less often and using less battery.
Audio tunneling can dramatically improve battery life for use-cases such as listening to
music over a headset with the screen off.
āˆ’ For example, Nexus 5 offers a total off-network audio playback time of up to 60 hours, an increase of over
50% over non-tunneled audio.
Media applications can take advantage of audio tunneling on supported devices without
needing to modify code. Audio tunneling requires support in the device hardware.
Offloading audio to the DSP
Enabling low power & increased concurrency
48
• Sleep tracking apps normally use the accelerometer in
your phone to sense your movements during sleep
• By using the accelerometer on wearables you don’t need
to keep your phone in bed and get more precise
readings
• Sensor batching is when the DSP is collecting sensor
data samples in the background with the AP shut down,
and then when the AP wakes up, it provides a ā€œbatchā€ of
sensor data to the AP for processing and display
• Without sensor batching: 8 hours of sleep tracking
uses 70-100% of battery life
• With sensor batching: 8 hours of sleep tracking uses
10-20% of battery life
Real World Example: Sleep Tracking
Source: https://sites.google.com/site/sleepasandroid/doc/integration
49
Use wakelocks only when necessary, use the minimum levels possible and release them as
soon as possible. Use KEEP_DISPLAY_ON instead
Close TCP sockets when done. Otherwise, you unnecessarily bring up the network
just to tear down. This simple fix can reduce network power up to 20%
Group network activity when possible; Be flexible in your ping times
Review Best Practice for detailed solutions to power and performance-related problems
Turn off functions like GPS, camera, accelerometer and other sensors when they are no
longer required
Recap of power saving tips
50
Summary
Long battery life is very important to consumers
There is no excuse for bad power management –
Free software is available that makes it easy to locate
and fix problems with excessive power consumption
Better battery life can give your app an advantage over
the competition, which could result in more positive reviews
51
QualcommĀ® Snapdragonā„¢
Performance Visualizer
Kevin Sapp
Engineer, Principal/Mgr
Qualcomm Technologies, Inc.
52
Snapdragon Performance Visualizer (SPV) is a
comprehensive software tool suite that is designed
to enable Android developers using the Snapdragon
Mobile Development Platform (MDP) to visualize,
analyze and correlate the impact of detailed CPU
and system data on application performance,
making it easier to pinpoint and resolve
performance bottlenecks.
53
The GUI is web based
āˆ’ Dojo
āˆ’ JavaScript
āˆ’ Scalable Vector Graphics (SVG)
āˆ’ JSON
Command Line
āˆ’ ssh access for advanced command line tools
āˆ’ Access to ā€œperfā€ command line
āˆ’ Other familiar tools, top, strace, etc
āˆ’ Scripting (bash, perl) for automation
Automation
āˆ’ Web based automation APIs available for many of the tools
āˆ’ http://server:7376/api/setSessionTimeout&sessionId=131074&timeout=3600
How Does SPV Work
Web based tool set and more
54
Monitor performance
Examine performance monitors (CPU, L2, GPU, DSP)
Visualize system traces
Statistical (time or event) profiling
Add custom data, custom markers
Thermal data
Integrate with power monitoring (QEPM) tools
Memory leak and allocation corruption detection
Kernel probes
B and E markers from Atrace
Runs on most Linux based distributions (Android, Ubuntu, Debian, Tizen, Chrome, etc)
What can SPV do?
Tools to monitor the system post processed and in real-time
55
Live View
56
CPU Information
āˆ’ Performance Monitors (cache hits)
āˆ’ Utilization
āˆ’ Frequency
āˆ’ Temperature
āˆ’ more
GPU Information
āˆ’ Performance monitors
āˆ’ Utilization
āˆ’ Frequency
āˆ’ more
DSP
āˆ’ Performance Monitors
Live View
Real time collection and Visualization of time correlated system data
57
Live View (2)
Live View is the bridge to ProfileView’s advanced visualization and correlations
=
Source: Snapdragon Performance Visualizer screen shots
58
Custom Data
59
File Line Field
āˆ’ Reads /proc, /sys, /debugfs files
āˆ’ Periodically plots the value in a specific File
…
āˆ’ At a specific Line number
āˆ’ And a specific Field on that line
Named Pipes
āˆ’ Marker
āˆ’ Long
āˆ’ Double
āˆ’ Binary
Adding Custom Data to SPV
Mechanisms to extend SPV with your unique data
60
File Line Field node
āˆ’ Look at the run-queue depth on CPU0
āˆ’ Stored in
/sys/devices/system/cpu/cpu0/rq-
stats/run_queue_avg
Pipe data format is:
āˆ’ timestamp,data<cr> -or- ,data<cr>
āˆ’ Timestamp is gtod, in decimal seconds
āˆ’ e.g. 12345.34567
āˆ’ Data can be written from shells using
echo
āˆ’ echo ā€œ,123.456ā€ > /tmp/namedpipe
Adding Custom Data to SPV
Some simple code and nodes
61
Profiling and Trace
62
Sample based profiling
Uses ā€œperf recordā€ under the covers
Not real-time
āˆ’ Collect – Stop – Analyze
Multiple Visualizations
āˆ’ Text Based (Oprofile)
āˆ’ ProfileView GUI
Libs provided for instrumented code
Profiling
Statistical and instrumented
Source: Snapdragon Performance Visualizer screen shots
63
Correlate events
See when frequency changes
Which processes/threads are running
When CPU issues commands to GPU
Per-context Performance Monitors
Call stack analysis
Hot Spot analysis
Not real-time
āˆ’ Collect – Stop – Analyze
Correlates with Live View data
Correlates with Profile data
Correlates with Custom data
Tracing
Instrumented kernel and code
Source: Snapdragon Performance Visualizer screen shots
64
QualcommĀ® Embedded
Power Monitor (QEPM)
Qualcomm Embedded Power Monitor is a product of Qualcomm Technologies, Inc.
65
Monitors current and voltage rails
Combined sample rates up 50K
Simultaneously monitor multiple devices
Correlate data with SPV
āˆ’ Frequency
āˆ’ Thermal
āˆ’ Performance
Web based
Automation interface
Data export capabilities
QEPM
Source: Snapdragon Performance Visualizer screen shots
66
FAQ and Support for
SPV is available on
Qualcomm Developer Network
67
Graphics & Gaming
Manish Sirdeshmukh
Product Manager, Staff
Qualcomm Technologies, Inc.
Dave Astle
Principal Engineer, Manager
Qualcomm Technologies, Inc.
68
Gaming on mobile today
ā€œEpic now has brought Unreal Engine 4 to Android with the Snapdragon 800 and 805 chipsets from Qualcomm
Technologies,ā€ said Niklas Smedberg, Senior Engine Programmer, Epic Games. ā€œRecently we worked with Qualcomm
[QTI] to elevate graphics to the next level on the QualcommĀ® Snapdragonā„¢ Adreno GPU hardware, which delivers
some of the most power-efficient unified shader capabilities we’ve seen yet for Android smartphones and tablets.ā€
Comparison: PC Comparison: Mobile
Qualcomm Adreno is a product of Qualcomm Technologies, Inc.
69
Exponential increase in gaming performance
0
10
20
30
40
50
60
70
Snapdragon S1
(A200)
Snapdragon S2
(A205)
Snapdragon S3
(A220)
Snapdragon S4
(A225)
SnapdragonS4 Pro
(A320)
Snapdragon S600
(A320)
SnapdragonS800
(A330)
Snapdragon 805
(A420)
1
RelativePerformance
Averageforindustrystandardgraphicsbenchmarks
Source: Qualcomm Technologies, Inc. data
2010 2011 2012 2013 2014
65x
70
What is involved in games?
Image: Modern Combat 5 by Gameloft
Gameplay execution (animation):
Animation for water movement and
anchored boat motion
Gameplay execution (AI):
Enemy helicopter controlled by AI
Gameplay execution (physics):
Particle physics makes
explosions look real
Console-quality graphics:
Lens effect on the sunlight breaking
through the clouds
Console-quality graphics:
Hi-res textures provide rich
details to the scene
Console-quality graphics:
Bloom glare from gun fire provide
immersive experience
Fast connectivity:
Play a mission in multi-player gaming
High-quality video:
After completing the level, watch a
cut scene transition
Responsive and accurate control:
Control the character movement
Multi-screen experience:
Mirror your screen to TV
Cinema-quality sound:
Hear gunfire, explosions, bullets
flying by, and the helicopter’s
rotor blades
71
How is SoC utilized by a game?
Heterogeneous hardware blocks and data flow
Graphics Textures,
Shaders, Geometry
Video
Data
Audio
Data
Start
Quad Core CPU
System Memory
Final Frame
CPU #1 CPU #2 CPU #3 CPU
#4
Physics
Animation
Gamelogic
Artificial
Intelligence
To Display Panel
To Wi-Fi
Display Panel
Encoded
Final
Frame
Input Signals
DisplayReads
GPUReads
Video
Graphics Rendering
Audio
GraphicsPixelWrites
Video Pixel Writes
To Speakers
Wi-Fi
Engine
Video
Decoder
Video
Encoder
DSP
(Audio Decoder)
Sensor
Engine
Display
Engine
GPU
72
Let’s focus on Samsung Galaxy Note 4 hardware
Processor Snapdragon 805
CPU Quad-core Krait 450 CPU at up to 2.7 GHz per core
GPU Adreno 420 GPU
DSP QualcommĀ® Hexagonā„¢ V50 DSP (up to 800MHz)
Display 4K Ultra HD on-device display concurrent with 4K Ultra HD
output to HDTV
1080p and 4K external displays
Memory LPDDR3 800MHz Dual-channel 64-bit (25.6GBps)
Qualcomm Hexagon is a product of Qualcomm Technologies, Inc.
73
Desktop and console quality graphics on mobile
Complete DirectX11 FL 11_2 pipeline, supports
OpenGL ES 3.1
Support for dynamic
hardware tessellation
& geometry shaders
Samsung Galaxy Note 4 GPU highlights
Richer, visually immersive graphics
No Tessellation Tessellation
74
Samsung Galaxy Note 4 supports most advanced graphics APIs
Feature/APIs OpenGL ES 3.0 OpenGL ES 3.1 Android Extension Pack
Compute Shader No Yes Yes
Atomics No Yes Yes
Image Load/Store No Yes Yes
Draw Indirect No Yes Yes
Texture Gather No Yes Yes
Multisample Textures No Yes Yes
Stencil Textures No Yes Yes
Separate Shader Objects No Yes Yes
Advanced Blending Modes
(Programmable Blending)
No Yes Yes
Geometry Shaders No No Yes
Tessellation Shaders No No Yes
75
Improved architecture for performance & efficiency
Better performance
Reduced power consumption
Samsung Galaxy Note 4 GPU highlights
Direct
Rendering
Tiled
Rendering
Dynamic
Switching
Original ASTC Compression
24bpp 8bpp 3.56bpp 2bpp
Unified Shaders
Pixel | Vertex | Compute
Tessellation | Geometry
Adreno GPU
System memory
Adreno GPU
System memory
Tile buffer
76
GPU architecture
Tiled Rendering
architecture
Advantages:
Designed to minimize unnecessary data traffic to host memory
Designed to minimize power consumption
Use of transparency/anti-aliasing is inexpensive
Objects in
background
Objects in
foreground
Advantages:
• Designed to prevent unnecessary use of GPU
resources in drawing pixels for occluded objects
• Designed to increase overall graphics performance
for larger scenes with opaque geometry
Early Z (Depth) Reject feature
77
GPU architecture
Adreno GPU
System memory
Direct rendering
GMEM (Tile Buffer)
Adreno GPU
System memory
Tiled rendering
FlexRender
Dynamic
Switching
1X
Speed for
ā€œhighpā€ Shaders
2X
Speed for
ā€œmediumpā€ Shaders
Dynamic FlexRender technology
Advantages:
Better performance and power for wider range of use cases
More developer flexibility
Advantages:
• Use additional/complex shaders without compromising
performance
• Better performance with power efficiency
Double Rate Half Precision (DRHP) design
78
OpenGL ES
optimizations
79
Optimization: frame buffer objects
Worst case pattern of FBO usage
Frame buffer
Clear Draw
FBO 0
Draw
Frame buffer
Draw
Store Store
Load Load
Store
Frame rendering
80
Optimization: frame buffer objects
Optimized render order
Invalidate Framebuffer Draw
Optimal rendering order:
FBO0 invalidate, FBO0 draw …
FBOn invalidate, FBOn draw,
FB clear, FB draw
Frame rendering
Frame buffer
Store
Clear Draw
FBO 0
Store
81
In the worst case the complete sequence of VBO updates
and draw calls may have to be repeated for each bin
Even when using glBufferSubData multiple copies of the
entire VBO may need to be maintained by the driver
Optimization: dynamic vertex buffer objects
Worst case pattern of VBO usage
Update VBO0 Update VBO0 Update VBO0Draw Draw Draw
Frame rendering
82
Optimization: dynamic vertex buffer objects
Optimized dynamic VBO order
Or if multiple dynamic VBOs are used
Update VBO0 Draw VBO0
Update VBO0 Update VBOn Draw VBO0 Draw VBOn
Frame rendering
Frame rendering
83
Sort by material
āˆ’ Reduces shader and texture state changes
Sort opaque draw calls front-to back
āˆ’ Reduces time spent shading fragments which will be overwritten later
āˆ’ Have observed > 10ms/frame performance increase in some fragment bound content with just this optimization.
Draw the skybox last
āˆ’ Typically the skybox is covered by foreground geometry in half or more of the screen
Optimization: sorting
Potential to reduce both the number of state changes as well as
overdraw - both of which have a negative impact on GPU performance
84
Operations on 16 bit floating point (mediump) values are 2x faster than on 32 bit (highp)
āˆ’ Recommend setting default precision
to medium and promoting only values
which require higher precision, E.g
Optimization: shader performance
Precision
Adreno 3xx and 4xx GPUs utilize a scalar architecture
Avoid using components that aren’t needed for the final result
Wherever possible re-order operations to execute on as few components as possible
Scalar architecture
precision mediump float; // Set default precision in FS to fp16
out vec2 vSmallTexCoord; // Uses mediump
out highp vec2 vLargeTexCoord; // Uses highp
85
High levels of tessellation can generate sub-pixel
triangles which cause poor rasterizer utilization
āˆ’ Very important to utilize distance, screen space size or
other adaptive metrics for computing tessellation
factors which avoid sub-pixel triangles
Optimization: tessellation
Tessellation allows for incredible levels of detail and can substantially reduce
memory bandwidth and CPU cycles by allowing other game sub-systems to
operate on low resolution representations of meshes, but …
Full Rasterizer Utilization Partial Rasterizer
Utilization
86
Hardware back-face culling occurs after the tessellation stage, which potentially wastes GPU
resources tessellating back facing primitives
Back-facing primitives can be identified in the TCS and culled by setting their edge
tessellation factors to 0
āˆ’ A slight ā€œfudgeā€ factor may be needed in this calculation if displacement mapping
will be used in the TES as this technique may change the visibility of primitives
Optimization: tessellation
Culling
Whenever possible disable the TCS and TES stages if the tessellation factor for the mesh
would be ~1
āˆ’ Eliminates the use of unnecessary GPU stages
General
87
Adreno tools
88
Graphics content development & tools
Asset
Creation
Compress/
Optimize
Code Emulate Compile Deploy Analyze/ Debug
89
Support for OpenGL ES 3.1, 3.0 & 2.0, DirectX,
and OpenCL
Supported on Windows, Mac OSX, and Linux
Comprehensive collection of utilities
Over 100 samples and tutorials
Thorough documentation
Adreno tools
Adreno SDK Adreno Profiler
Comprehensive profiling tool
Supported on Windows, Mac OSX, and Linux
Enables detailed analysis of GPU utilization
Proven effective and easy to use
Works with commercial devices & apps
Available on developer.qualcomm.com
Adreno SDK and Adreno Profiler and products of Qualcomm Technologies, inc.
90
Adreno Profiler: introduction
Grapher mode: real-time analysisScrubber mode : detailed frame analysis
API call stack
Optimization
suggestions
Shader stats
Shader editor
Texture browser
Detailed frame stats
Overrides
Metrics
Frame emulation
Scrubber metrics
91
Adreno Profiler demo
Reign of Amiraā„¢
Available on Google Play
Reign of Amira is a product of Qualcomm Technologies, Inc.
92
Adreno SDK
Desktop OpenGL ES emulator
āˆ’ Now supporting OpenGL ES 3.1
Over 100 samples and tutorials
āˆ’ Simple tutorials to advanced demos
āˆ’ Covers OpenGL ES 2.0 and 3.0, 3.1,
AEP DirectX, and OpenCL
Utilities and libraries
āˆ’ Texture compression
āˆ’ Mesh optimization
Adreno texture tool
Developer documentation
āˆ’ Adreno Developer Guide
Shader samples
Animal materials (fur, elephant skin,
fish scales, alligators, etc.)
General lighting (ambient, diffuse,
specular, Blinn-Phong, parallax, etc.)
Human materials (skin, eye, etc.) Other effects (environment mapping,
warping, glass distortion, god rays, etc.)
Other materials (cloth, wood, plastic,
marble, leather, metal, etc.)
Advanced rendering (toon shading,
deferred lighting, eye adaption, etc.)
93
Adreno SDK demo
Reign of Amiraā„¢
Available on Google Play
Reign of Amira is a product of Qualcomm Technologies, Inc.
94
Special thanks
95
For more information on Qualcomm, visit us at:
www.qualcomm.com & www.qualcomm.com/blog
Qualcomm is a trademark of Qualcomm Incorporated, registered in the United States and other countries.
Other products and brand names may be trademarks or registered trademarks of their respective owners
Thank you
Follow us on:
©2013-2014 Qualcomm Technologies, Inc. and/or its affiliated companies. All Rights Reserved.
Qualcomm, Snapdragon, Adreno, Gobi, Hexagon, FlexRender and Reign of Amira are trademarks of Qualcomm Incorporated, registered in the United
States and other countries. Fast CV and Krait are trademarks of Qualcomm Incorporated. All Qualcomm Incorporated trademarks are used with
permission. Other products and brand names may be trademarks or registered trademarks of their respective owners.
References in this presentation to ā€œQualcommā€ may mean Qualcomm Incorporated, Qualcomm Technologies, Inc., and/or other subsidiaries or business
units within the Qualcomm corporate structure, as applicable.
Qualcomm Incorporated includes Qualcomm’s licensing business, QTL, and the vast majority of its patent portfolio. Qualcomm Technologies, Inc., a
wholly-owned subsidiary of Qualcomm Incorporated, operates, along with its subsidiaries, substantially all of Qualcomm’s engineering, research and
development functions, and substantially all of its product and services businesses, including its semiconductor business, QCT.

More Related Content

PDF
Analyze and optimize Android apps power consumption
DroidConTLV
Ā 
PDF
How to Lower Android Power Consumption Without Affecting Performance
rickschwar
Ā 
PDF
Android power management, current and future trends
Soumya Kanti Datta
Ā 
PPT
Energy efficiency of android
littleeye
Ā 
PPTX
Understanding, debugging and fixing power bugs
littleeye
Ā 
PPTX
iOS Application Battery Optimization Techniques
Singsys Pte Ltd
Ā 
PDF
Doug Sillars on App Optimization
wipjam
Ā 
PDF
Data collection using tablets
Singhsapna
Ā 
Analyze and optimize Android apps power consumption
DroidConTLV
Ā 
How to Lower Android Power Consumption Without Affecting Performance
rickschwar
Ā 
Android power management, current and future trends
Soumya Kanti Datta
Ā 
Energy efficiency of android
littleeye
Ā 
Understanding, debugging and fixing power bugs
littleeye
Ā 
iOS Application Battery Optimization Techniques
Singsys Pte Ltd
Ā 
Doug Sillars on App Optimization
wipjam
Ā 
Data collection using tablets
Singhsapna
Ā 

Similar to Samsung Developer's Conference - Maximize App Performance while Minimizing Battery Drain (20)

PDF
How to Minimize Your App’s Power Consumption
Qualcomm Developer Network
Ā 
PDF
HH QUALCOMM how to minimize the power consumption of your app
Satya Harish
Ā 
PDF
Developing Mobile Apps for Performance - Swapnil Patel, Verizon Media
Yahoo Developer Network
Ā 
PDF
Android Tools for Qualcomm Snapdragon Processors
Qualcomm Developer Network
Ā 
PDF
Beyond Traditional Mobile Testing
ColomboCampsCommunity
Ā 
PDF
Mobile Saturday. Тема 2. ŠžŃŠ¾Š±ŠµŠ½Š½Š¾ŃŃ‚Šø Ń‚ŠµŃŃ‚ŠøŃ€Š¾Š²Š°Š½ŠøŃ ŠæŃ€ŠøŠ»Š¾Š¶ŠµŠ½ŠøŃ на Android: Spec...
GoIT
Ā 
PPTX
Android Mobile Application Testing: Specific Functional, Performance, Device ...
SoftServe
Ā 
PDF
[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...
NITHIN S.S
Ā 
PDF
Snapdragon 845 Benchmarking UX Workshop
Low Hong Chuan
Ā 
PPTX
MobileApplicationTesting.pptx
CbhaSlide
Ā 
PPTX
Desarrollo con AIR para Playbook
Software Guru
Ā 
ODP
Mobile applicationtesting
L ESHWAR
Ā 
PPTX
Paranoid android versatile protection for smartphone
Vichhaiy Serey
Ā 
PPTX
Optimizing Apps for Better Performance
Elif Boncuk
Ā 
PDF
XPDS13: Performance Optimization on Xen-based Android Device - Jack Ren, Inte...
The Linux Foundation
Ā 
DOCX
Green droid automated diagnosis of energy inefficiency for smartphone applica...
JPINFOTECH JAYAPRAKASH
Ā 
PPTX
Android Mobile Application Testing: Human Interface Guideline, Tools
SoftServe
Ā 
PDF
Smarter Apps for Smarter phones - see me at bit.ly/1ezHj0c
Jeffrey Gardner CMgr FCMI IEng MIET
Ā 
PDF
Power optimization for Android apps
Xavier Hallade
Ā 
PPTX
App Performance Tip: Sharing Flash Across Virtualized Workloads
DataCore Software
Ā 
How to Minimize Your App’s Power Consumption
Qualcomm Developer Network
Ā 
HH QUALCOMM how to minimize the power consumption of your app
Satya Harish
Ā 
Developing Mobile Apps for Performance - Swapnil Patel, Verizon Media
Yahoo Developer Network
Ā 
Android Tools for Qualcomm Snapdragon Processors
Qualcomm Developer Network
Ā 
Beyond Traditional Mobile Testing
ColomboCampsCommunity
Ā 
Mobile Saturday. Тема 2. ŠžŃŠ¾Š±ŠµŠ½Š½Š¾ŃŃ‚Šø Ń‚ŠµŃŃ‚ŠøŃ€Š¾Š²Š°Š½ŠøŃ ŠæŃ€ŠøŠ»Š¾Š¶ŠµŠ½ŠøŃ на Android: Spec...
GoIT
Ā 
Android Mobile Application Testing: Specific Functional, Performance, Device ...
SoftServe
Ā 
[TTT Meetup] Enhance mobile app testing with performance-centric strategies (...
NITHIN S.S
Ā 
Snapdragon 845 Benchmarking UX Workshop
Low Hong Chuan
Ā 
MobileApplicationTesting.pptx
CbhaSlide
Ā 
Desarrollo con AIR para Playbook
Software Guru
Ā 
Mobile applicationtesting
L ESHWAR
Ā 
Paranoid android versatile protection for smartphone
Vichhaiy Serey
Ā 
Optimizing Apps for Better Performance
Elif Boncuk
Ā 
XPDS13: Performance Optimization on Xen-based Android Device - Jack Ren, Inte...
The Linux Foundation
Ā 
Green droid automated diagnosis of energy inefficiency for smartphone applica...
JPINFOTECH JAYAPRAKASH
Ā 
Android Mobile Application Testing: Human Interface Guideline, Tools
SoftServe
Ā 
Smarter Apps for Smarter phones - see me at bit.ly/1ezHj0c
Jeffrey Gardner CMgr FCMI IEng MIET
Ā 
Power optimization for Android apps
Xavier Hallade
Ā 
App Performance Tip: Sharing Flash Across Virtualized Workloads
DataCore Software
Ā 
Ad

Recently uploaded (20)

PDF
Software Development Methodologies in 2025
KodekX
Ā 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
Ā 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
Ā 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
Ā 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
Ā 
PDF
This slide provides an overview Technology
mineshkharadi333
Ā 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
Ā 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
Ā 
PPTX
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
Ā 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
Ā 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
Ā 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
Ā 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
PDF
Doc9.....................................
SofiaCollazos
Ā 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
Ā 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
Ā 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
Ā 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
Ā 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
Ā 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
Ā 
Software Development Methodologies in 2025
KodekX
Ā 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
Ā 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
Ā 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
Ā 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
Ā 
This slide provides an overview Technology
mineshkharadi333
Ā 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
Ā 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
Ā 
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
Ā 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
Ā 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
Ā 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
Ā 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
Doc9.....................................
SofiaCollazos
Ā 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
Ā 
Coupa-Overview _Assumptions presentation
annapureddyn
Ā 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
Ā 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
Ā 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
Ā 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
Ā 
Ad

Samsung Developer's Conference - Maximize App Performance while Minimizing Battery Drain

  • 1. Maximize App Performance while Minimizing Battery Drain Qualcomm Technologies, Inc
  • 2. 2 Agenda The Challenge 1 Trepn Profiler Deep Dive 2 QualcommĀ® Snapdragonā„¢ Performance Visualizer 3 Graphics & Gaming 4 Qualcomm Snapdragon and Trepn are products of Qualcomm Technologies, Inc.
  • 3. 3 The Challenge Rick Schwartz Senior Product Manager Qualcomm Technologies, Inc.
  • 4. 4 High end processor speeds increased from 1.5 GHz to 2.7 GHz over the past 3 years The number of cores have increased 3 of the past 4 years Mobile displays are getting larger and higher in resolution āˆ’ HD (1280x720) > FHD (1920x1080) > QHD (2560x1440) Some mobile devices now designed to work 24/7 āˆ’ Tracking location āˆ’ Listening for voice commands āˆ’ Step counters track movement A single mobile processor can replace several discrete chips Mobile trends resulting in increased power consumption Source: Qualcomm Technologies, Inc. data
  • 5. 5 Battery capacity hasn’t kept up Processor specs for flagship Android devices by year Power (mAh) 3500 3000 2500 2000 1500 1000 2.5 2 1.5 1 0.5 0 2012 2013 2014 Frequency (GHz) Frequency 33% increase in battery power Battery Source: Qualcomm Technologies, Inc. data 2012 – Samsung Galaxy S III - Snapdragon S4 SoC featuring a dual-core 1.5 GHz; 2100mAh 2013 – Samsung Galaxy S4 - Qualcomm Snapdragon 600 APQ8064AB quad-core 1.9 GHz; 2600 mAh 2014 – Samsung Galaxy S5 - Qualcomm Snapdragon 801 (8974) 2.5 GHz quad-core; 2800 mAh 80% increase in processor speeds 0500 4000
  • 6. 6 Battery life is very important to consumers Consumers rank phone battery life as the most important factor in their smartphone buying decision. Q: For your next smartphone/mobile phone purchase, which of the following features would drive your decision to select one phone over others? Importance of Smartphone Features Among Smartphone Buyers1 38% 42% 44% 46% 46% 48% 52% 72% Display / screen resolution Memory / storage 4G or LTE connectivity Screen / display type / quality Screen / display size Touchscreen WiFi speed / quality Battery life 1 Source: Qualcomm Brand Tracker, Market Research Group. United States, January 2014 Top 10 Smartphone Purchase Drivers2 Android vs. iOS Windowsvs. Battery Life Ease of Use Operating System Android, Symbian, webOS, Windows Mobile Touch Screen Screen Size 56% 49% 53% 33% 39% 38% 37% 32% 40% 34% 34% 37% 37% 22% 34% 2 Source: IDC's ConsumerScape 360 by IDC Michael DeHart
  • 7. 7 ā€œHigh-riskā€ apps can waste power and mobile data List of ā€œhigh riskā€ apps that drain the battery faster than normal typically highlighted Unexpected data usage 2 to 5 times faster than normal Over 70% of these apps are chart toppers in Google Play Some of these apps can cause the battery to drain 2 to 5 times faster than normal Some of these apps can cause unexpected data usage (up to 2.2GB a month) Source: Descriptions taken from Verizon’s High-risk App site. April 2014
  • 8. 8 Heavy battery usage is a top reason consumers uninstall apps What causes users to delete an app? 76% 59% 71% 55% 53% Freezes Slow responsiveness Crashes Heavy battery usage Too many ads Source: Fierce Developer Survey – Exploring the reasons users complain about apps (Nov. 2012) #1 #2 #3 #4 #5
  • 9. 9 Does your app consume too much power?
  • 10. 10 1. Compare your app to the competition – Look at idle power and real world use cases 2. If you can measure it, you can act on it – Does code A or code B consumer more power? How to: Accurately measure the power consumption of your app ā€œProfile Appā€ or ā€œProfile Systemā€ Launch Trepn, go to Settings, and select the Battery Power data point Check ā€œAcquire Wakelock while Profilingā€ keep your processor awake 1 2 3 App #2 consumed 500% more power than idle and 53% more power than a similar app Device idle (Screen off after 2 min) App #1 consumed 3.2x more power than idle (Screen off after 2 min.) Source: Trepn Profiler screenshots | Trepn is a product of Qualcomm Technologies, Inc.
  • 11. 11 What if your device doesn’t support battery power? Here are some of the many options available Android 5.0 Battery app GSam Battery Monitor Pro Power Tutor
  • 12. 12 1. Remove your USB cable – Trepn cannot display accurate power readings when your mobile device is charging or connected to a computer. Tip: Use ADB over Wi-Fi 2. Make sure your device reports accurate battery power – Supported devices include : Nexus 4, Nexus 5, Nexus 7, HTC One (2013), Sony Xperia ZL, HTC Droid DNA and more 3. Make sure your CPU stays awake – Check ā€œAcquire Wakelock while Profilingā€ in Settings 4. Minimize background processes – It’s not enough to close everything in Recent Apps. Go to the Task manager and clear memory; Open the Apps manager, go to Running and close all remaining unneeded apps, and stop all unneeded services āˆ’ Pure Android devices are better for testing because they have fewer preinstalled apps and less running in the background āˆ’ Before closing unused apps: 1043mW. After closing unused apps : 726mW. A 30% difference! Software Power Measurement Best Practices
  • 13. 13 5. Focus on what you’re measuring – Turn off everything that is not related to what you want to measure (e.g., Screen when possible, Wi-Fi, Mobile networks, Location (GPS), Bluetooth, Google Now, etc.). 6. Reduce overhead – Don’t use more data points than you need because this increases system resource consumption. Make sure ā€œShow Per-Application Statis..ā€ is unchecked, unless you need to see the mobile and Wi-Fi data transmitted. Turn off screen overlays 7. Minimize the impact of the screen – The screen is the biggest consumer of power. If you don’t need the screen to be easily readable, you turn it off or set the screen timeout to a short value (e.g., 1 minute) 8. Compare apples to apples – Don’t try to compare on-target measurements with off-target (e.g. Monsoon) measurements Software Power Measurement Best Practices, cont.
  • 14. 14 1. Go to developer.qualcomm.com and register. Log-in and download Trepn Profiler under ā€˜Increase App Performance’ 2. Install and launch Trepn and go to Settings āˆ’ Under ā€˜General,’ check ā€˜Acquire Wakelock while profiling’ āˆ’ Under ā€˜Data Points,’ check ā€˜CPU2 Frequency’ and ā€˜CPU3 Frequency’ and uncheck ā€˜Application State’ āˆ’ Go to ā€˜Overlays’ and add Graph overlays in the lower corners for ā€˜CPU2 Frequency’ and ā€˜CPU3 Frequency’ 3. Go to Settings/General Save Preferences, type ā€˜Default’ preference and touch Save 4. Touch Back, ā€˜Profile System’ and ā€˜Graph’ 5. Touch the Back button and ā€˜Overlays’ 6. Go to Notification bar and touch ā€˜Stop Profiling’ 7. Save as .db, so the session can be analyzed later Demo: Using Trepn to profile your mobile processor
  • 15. 15 Is this app CPU bound or GPU bound?
  • 16. 16 Is this app using all four of the CPU cores? Source: Trepn screenshot of 3DMark Extreme benchmark
  • 17. 17 Trepn tracks the actual power consumed at a level of detail that is unmatched by most other on-target profilers Source: Screenshot of Trepn Profiler running GLBench
  • 18. 18 How much power is saved when playing a 4K video using the hardware decode option? Video playback using S/W decoder option Video playback using H/W decoder option 43% less power consumedAlmost 3x more CPU consumed load
  • 19. 19 Is this app using system resources efficiently? Source: Trepn screenshot
  • 20. 20 Pros āˆ’ Measures voltage, current and power āˆ’ Very accurate āˆ’ Doesn’t consume CPU cycles (or other system resources) like on-target solutions Cons āˆ’ Must attach wires to the battery in your mobile device āˆ’ Can be expensive ($770) āˆ’ Can’t measure per-app or per-rail power The pros and cons of off-target measurement
  • 21. 21 QualcommĀ® Snapdragonā„¢ MDP development hardware have sense resistors placed on the following hardware rails: āˆ’ CPU, Camera, Digital Core, Graphics, Internal Memory, LCD Backlight, SD Card and WLAN/BT If you have a fixed resistance and know the voltage, you can easily determine the power (P = V²/R). An EPM PSoC converts these analog voltages to digital, so Trepn Profiler can display them Measuring per-rail power consumption Power Delta Before Photo Taken Source: Trepn Profiler screenshots Power Delta After Photo Taken
  • 22. 22 How to: Profile Your App Without Leaving Your IDE Installing the Trepn plug-in for Eclipse 1. Launch Eclipse 2. Select Help Install New Software 3. Click Add … and Enter: • Name – you may use any name, such as Trepn Plugin • Location – https://developer.qualcomm.com/docs/trepn/eclipse/ • Click OK 4. Select the Trepn Plugin checkbox and click Next 5. In Install Details, click Next 6. Review and accept the license agreement and click Finish: • If you see a security warning regarding unsigned content, click OK • Installing dependencies may take a few minutes 7. After installation completes, restart Eclipse 8. Select Window Open Perspective Other 9. Select Trepn and click OK – Downloading additional files may take a few minutes
  • 23. 23 Profiling in Eclipse Starting and Stopping Profiling 1. Connect your device to the computer via USB 2. Confirm your device is listed as a connected device 3. In the Trepn Control pane (left side), click the green play icon to start profiling: • The Trepn APK will be installed on your device if necessary
  • 24. 24 Trepn plug-in demo Source: Trepn plug-in screen capture
  • 25. 25 Using Trepn to See What’s Happening Behind the Scenes The Trepn plug-in shows what your phone is doing when it’s idle Source: A portion of the Trepn plug-in screen All 4 cores are active here GPU active here 250mA to 350mA of power is used here Even though the cellular radio is idle, it still consumers up to 150mA of power GPS active here Wi-Fi active here
  • 26. 26 Trepn shows how much data and CPU is used Source: Trepn Profiler screenshots Mobile data usage Wi-Fi data usage CPU usage by app
  • 27. 27 Playing Mobile Data Detective Small changes can make a big difference Source: Trepn plug-in screens Mobile data transmitted before one setting is turned off Mobile data transmitted after one setting is turned off
  • 28. 28 Trepn Shows Whether the Cellular Radio Is Being Used in an Efficient Manner Source: Trepn Profiler screenshots
  • 29. 29 A dormant cellular radio consumes less than 10 mA When data is sent or received, the radio comes up and goes into an active state, consuming 250-300mA When not sending data, the radio drops down to idle, but still consumes about 150mA After a timeout of 8 to 15 seconds, the radio finally goes back to a dormant state Why this is a problem Connected (Idle) 8-15 seconds Current(mA) Connected (Active) Time (seconds) <10mA 250-300 mA ~150 mA
  • 30. 30 Connect less often – After you transmit data, the radio stays on for an additional 10 to 12 sec1 Push, don’t poll – Specify how often items are delivered1 Use analytics wisely1 āˆ’ Capture data locally and group transmissions to your server. Extend the time between transmissions Offer ad-free versions of apps – Apps without ads connect to the network much less often Don’t continuously scan1 āˆ’ Create timeouts appropriately when scanning for Wi-Fi networks or GPS signals Don’t continuously stream – Download streams in chunks1 Offload to Wi-Fi – It uses significantly less battery than 3G or 4G1 Use the new JobScheduler APIs that are part of Android 5.02 Use Battery Historian to view wakelocks and mobile radio usage2 (http://github.com/google/batteryhistorian) How to efficiently use your cellular radio and Wi-Fi network 1 Source: AT&T ā€œTips to Increase Battery Life Handoutā€ from AnDevCon 2013 2 Google I/O 2014 - Introduction to Project Volta by (Meghan Desai and Matthew Jay Williams)
  • 31. 31 The use JobScheduler APIs coalesces mobile radio activity As a result, there is less overhead per mobile radio transmission Source: Battery Historian Slide from Google I/O 2014 - Introduction to Project Volta by (Meghan Desai and Matthew Jay Williams) Before After
  • 32. 32 Bundling traffic can reduce overhead-to-data ratio Source: The Smartphone Challenge: Signaling Congestion and Power Consumption - Gerardo Giaretta – Qualcomm Technologies Inc. Ta Tb Tc The amount of overhead to each data burst is high Bundling data results in shorter connection time and less overhead Td Td Td < Ta+ Tb + Tc Bundling or gating reduces the number of times the device connects to the network, which reduces signaling and power consumption Data from different apps Overhead (Radio on duration) Overhead transmission continues (based on dormancy timer) before terminal goes back to idle
  • 33. 33 The benefit of using your cellular radio more efficiently Bundling data results in significant power savings ~9000mA ~5000mA Nearly half the power! 300 150 10 2 minutes1 minute 3 minutes 2 minutes1 minute 3 minutes 300 150 10 Power(mA)Power(mA) Source: Qualcomm Technologies, Inc. data
  • 34. 34 Trepn Profiler Deep Dive Eugene Kolinko Senior Engineer Qualcomm Technologies, Inc.
  • 35. 35 How to: Insert Markers in Your Code to Identify the Causes of CPU, GPU and Power Spikes Trepn correlates system events with your code Step 1: Insert Application State markers in your code. Step 2: Track your app activity in Trepn.
  • 36. 36 Identifying the cause of power spikes in your code Inserting markers in your code can help identify the cause of power spikes Source: Trepn Profiler screenshots
  • 37. 37 How to: Using Application States to Analyze Automated Data Using application states in automated tests to get average data 0 1000 2000 3000 4000 5000 6000 300 422 652 729 883 960 1036 1190 1267 1497 1574 1728 1958 2265 BatteryPower(mW) Frequency (MHz) Effect of Frequency Scaling on Battery Power
  • 38. 38 How to: Perform Automated Testing With Trepn Trepn measures the effect of frequency scaling on battery power
  • 39. 39 Common Causes of Excess Power Consumption
  • 40. 40 Common causes of excessive power consumption Preventing the processor (or other hardware subsystems) from going to sleep 1 Inefficient use of the cellular radio and Wi-Fi network 3 Keeping the display lit too long 2 4 Taking too many GPS location fixes
  • 41. 41 To test, unplug your device and run it for at least 2-3 hours A large number of short wakelocks or wakeup triggers can have a negative impact on battery usage because a phone takes time to wake and go back asleep Does your app prevent the processor from going to sleep? Using Wakelock Detector (WLD) to identify processor sleep problems (Android 4.3 and earlier) CPU Wakelocks Wakeup Triggers
  • 42. 42 A Nexus 5 in standby gets almost one month of battery life -- yet most consumers get less than one day The reason: You trade two minutes of standby power every hour for 1 second of activity. With 50 apps, 100 minutes of standby power is consumed every hour Why this is a big deal Notes from Google’s Android Performance Primer at Google I/O (Intro to Project Volta) Source: Slides from Google I/O 2014 - Introduction to Project Volta by (Meghan Desai and Matthew Jay Williams) Google studied the power consumed for three typical use cases
  • 43. 43 Do not acquire PowerManager.Wakelocks unless you really need them āˆ’ Device battery life will be significantly affected by the use of this API Use the minimum levels needed Be sure to release wakelocks as soon as possible To keep the screen lit when your app is in the foreground, use FLAG_KEEP_SCREEN_ON instead Consider using AlarmManager in situations when you want to have your application code run at a specific time. Beginning with KitKat, the OS will shift alarms to minimize wakeups and battery usage. For normal timeouts, it’s easier and more efficient to use Handler How to avoid preventing your device from going to sleep Expert advice how to use wakelocks more efficiently Source: http://developer.android.com/reference/android/os/PowerManager.html#PARTIAL_WAKE_LOCK
  • 44. 44 The Wi-Fi radio will only turn off if no WifiLocks are held by any application Before using a WifiLock, consider if your app requires Wi-Fi access,or could function of the mobile network Large file downloads should hold a WifiLock to ensure the download will complete Using WifiLocks more efficiently Here’s what Google says about the use of WifiLocks Source: http://developer.android.com/reference/android/net/wifi/WifiManager.WifiLock.html
  • 45. 45 Make sure you don’t take a GPS fix when it’s not needed – AT&T’s ARO and Trepn plug- in show when GPS fixes occur Use coarse GPS fixes when possible, because they require much less power Let LocationManager find the best provider for you Have a timeout if you can’t find a satellite Make the user aware when location tracking is active Make it easy for users to disable location tracking without crippling their device How to save power when using the GPS
  • 46. 46 Benefits of offloading to a DSP Power savings running FastCVā„¢ facial detection to run on a DSP instead of CPU FastCV is a product of Qualcomm Technologies, Inc.
  • 47. 47 Android 4.4 adds platform support for audio tunneling to a digital signal processor (DSP) in the device chipset, waking the application processor less often and using less battery. Audio tunneling can dramatically improve battery life for use-cases such as listening to music over a headset with the screen off. āˆ’ For example, Nexus 5 offers a total off-network audio playback time of up to 60 hours, an increase of over 50% over non-tunneled audio. Media applications can take advantage of audio tunneling on supported devices without needing to modify code. Audio tunneling requires support in the device hardware. Offloading audio to the DSP Enabling low power & increased concurrency
  • 48. 48 • Sleep tracking apps normally use the accelerometer in your phone to sense your movements during sleep • By using the accelerometer on wearables you don’t need to keep your phone in bed and get more precise readings • Sensor batching is when the DSP is collecting sensor data samples in the background with the AP shut down, and then when the AP wakes up, it provides a ā€œbatchā€ of sensor data to the AP for processing and display • Without sensor batching: 8 hours of sleep tracking uses 70-100% of battery life • With sensor batching: 8 hours of sleep tracking uses 10-20% of battery life Real World Example: Sleep Tracking Source: https://sites.google.com/site/sleepasandroid/doc/integration
  • 49. 49 Use wakelocks only when necessary, use the minimum levels possible and release them as soon as possible. Use KEEP_DISPLAY_ON instead Close TCP sockets when done. Otherwise, you unnecessarily bring up the network just to tear down. This simple fix can reduce network power up to 20% Group network activity when possible; Be flexible in your ping times Review Best Practice for detailed solutions to power and performance-related problems Turn off functions like GPS, camera, accelerometer and other sensors when they are no longer required Recap of power saving tips
  • 50. 50 Summary Long battery life is very important to consumers There is no excuse for bad power management – Free software is available that makes it easy to locate and fix problems with excessive power consumption Better battery life can give your app an advantage over the competition, which could result in more positive reviews
  • 51. 51 QualcommĀ® Snapdragonā„¢ Performance Visualizer Kevin Sapp Engineer, Principal/Mgr Qualcomm Technologies, Inc.
  • 52. 52 Snapdragon Performance Visualizer (SPV) is a comprehensive software tool suite that is designed to enable Android developers using the Snapdragon Mobile Development Platform (MDP) to visualize, analyze and correlate the impact of detailed CPU and system data on application performance, making it easier to pinpoint and resolve performance bottlenecks.
  • 53. 53 The GUI is web based āˆ’ Dojo āˆ’ JavaScript āˆ’ Scalable Vector Graphics (SVG) āˆ’ JSON Command Line āˆ’ ssh access for advanced command line tools āˆ’ Access to ā€œperfā€ command line āˆ’ Other familiar tools, top, strace, etc āˆ’ Scripting (bash, perl) for automation Automation āˆ’ Web based automation APIs available for many of the tools āˆ’ http://server:7376/api/setSessionTimeout&sessionId=131074&timeout=3600 How Does SPV Work Web based tool set and more
  • 54. 54 Monitor performance Examine performance monitors (CPU, L2, GPU, DSP) Visualize system traces Statistical (time or event) profiling Add custom data, custom markers Thermal data Integrate with power monitoring (QEPM) tools Memory leak and allocation corruption detection Kernel probes B and E markers from Atrace Runs on most Linux based distributions (Android, Ubuntu, Debian, Tizen, Chrome, etc) What can SPV do? Tools to monitor the system post processed and in real-time
  • 56. 56 CPU Information āˆ’ Performance Monitors (cache hits) āˆ’ Utilization āˆ’ Frequency āˆ’ Temperature āˆ’ more GPU Information āˆ’ Performance monitors āˆ’ Utilization āˆ’ Frequency āˆ’ more DSP āˆ’ Performance Monitors Live View Real time collection and Visualization of time correlated system data
  • 57. 57 Live View (2) Live View is the bridge to ProfileView’s advanced visualization and correlations = Source: Snapdragon Performance Visualizer screen shots
  • 59. 59 File Line Field āˆ’ Reads /proc, /sys, /debugfs files āˆ’ Periodically plots the value in a specific File … āˆ’ At a specific Line number āˆ’ And a specific Field on that line Named Pipes āˆ’ Marker āˆ’ Long āˆ’ Double āˆ’ Binary Adding Custom Data to SPV Mechanisms to extend SPV with your unique data
  • 60. 60 File Line Field node āˆ’ Look at the run-queue depth on CPU0 āˆ’ Stored in /sys/devices/system/cpu/cpu0/rq- stats/run_queue_avg Pipe data format is: āˆ’ timestamp,data<cr> -or- ,data<cr> āˆ’ Timestamp is gtod, in decimal seconds āˆ’ e.g. 12345.34567 āˆ’ Data can be written from shells using echo āˆ’ echo ā€œ,123.456ā€ > /tmp/namedpipe Adding Custom Data to SPV Some simple code and nodes
  • 62. 62 Sample based profiling Uses ā€œperf recordā€ under the covers Not real-time āˆ’ Collect – Stop – Analyze Multiple Visualizations āˆ’ Text Based (Oprofile) āˆ’ ProfileView GUI Libs provided for instrumented code Profiling Statistical and instrumented Source: Snapdragon Performance Visualizer screen shots
  • 63. 63 Correlate events See when frequency changes Which processes/threads are running When CPU issues commands to GPU Per-context Performance Monitors Call stack analysis Hot Spot analysis Not real-time āˆ’ Collect – Stop – Analyze Correlates with Live View data Correlates with Profile data Correlates with Custom data Tracing Instrumented kernel and code Source: Snapdragon Performance Visualizer screen shots
  • 64. 64 QualcommĀ® Embedded Power Monitor (QEPM) Qualcomm Embedded Power Monitor is a product of Qualcomm Technologies, Inc.
  • 65. 65 Monitors current and voltage rails Combined sample rates up 50K Simultaneously monitor multiple devices Correlate data with SPV āˆ’ Frequency āˆ’ Thermal āˆ’ Performance Web based Automation interface Data export capabilities QEPM Source: Snapdragon Performance Visualizer screen shots
  • 66. 66 FAQ and Support for SPV is available on Qualcomm Developer Network
  • 67. 67 Graphics & Gaming Manish Sirdeshmukh Product Manager, Staff Qualcomm Technologies, Inc. Dave Astle Principal Engineer, Manager Qualcomm Technologies, Inc.
  • 68. 68 Gaming on mobile today ā€œEpic now has brought Unreal Engine 4 to Android with the Snapdragon 800 and 805 chipsets from Qualcomm Technologies,ā€ said Niklas Smedberg, Senior Engine Programmer, Epic Games. ā€œRecently we worked with Qualcomm [QTI] to elevate graphics to the next level on the QualcommĀ® Snapdragonā„¢ Adreno GPU hardware, which delivers some of the most power-efficient unified shader capabilities we’ve seen yet for Android smartphones and tablets.ā€ Comparison: PC Comparison: Mobile Qualcomm Adreno is a product of Qualcomm Technologies, Inc.
  • 69. 69 Exponential increase in gaming performance 0 10 20 30 40 50 60 70 Snapdragon S1 (A200) Snapdragon S2 (A205) Snapdragon S3 (A220) Snapdragon S4 (A225) SnapdragonS4 Pro (A320) Snapdragon S600 (A320) SnapdragonS800 (A330) Snapdragon 805 (A420) 1 RelativePerformance Averageforindustrystandardgraphicsbenchmarks Source: Qualcomm Technologies, Inc. data 2010 2011 2012 2013 2014 65x
  • 70. 70 What is involved in games? Image: Modern Combat 5 by Gameloft Gameplay execution (animation): Animation for water movement and anchored boat motion Gameplay execution (AI): Enemy helicopter controlled by AI Gameplay execution (physics): Particle physics makes explosions look real Console-quality graphics: Lens effect on the sunlight breaking through the clouds Console-quality graphics: Hi-res textures provide rich details to the scene Console-quality graphics: Bloom glare from gun fire provide immersive experience Fast connectivity: Play a mission in multi-player gaming High-quality video: After completing the level, watch a cut scene transition Responsive and accurate control: Control the character movement Multi-screen experience: Mirror your screen to TV Cinema-quality sound: Hear gunfire, explosions, bullets flying by, and the helicopter’s rotor blades
  • 71. 71 How is SoC utilized by a game? Heterogeneous hardware blocks and data flow Graphics Textures, Shaders, Geometry Video Data Audio Data Start Quad Core CPU System Memory Final Frame CPU #1 CPU #2 CPU #3 CPU #4 Physics Animation Gamelogic Artificial Intelligence To Display Panel To Wi-Fi Display Panel Encoded Final Frame Input Signals DisplayReads GPUReads Video Graphics Rendering Audio GraphicsPixelWrites Video Pixel Writes To Speakers Wi-Fi Engine Video Decoder Video Encoder DSP (Audio Decoder) Sensor Engine Display Engine GPU
  • 72. 72 Let’s focus on Samsung Galaxy Note 4 hardware Processor Snapdragon 805 CPU Quad-core Krait 450 CPU at up to 2.7 GHz per core GPU Adreno 420 GPU DSP QualcommĀ® Hexagonā„¢ V50 DSP (up to 800MHz) Display 4K Ultra HD on-device display concurrent with 4K Ultra HD output to HDTV 1080p and 4K external displays Memory LPDDR3 800MHz Dual-channel 64-bit (25.6GBps) Qualcomm Hexagon is a product of Qualcomm Technologies, Inc.
  • 73. 73 Desktop and console quality graphics on mobile Complete DirectX11 FL 11_2 pipeline, supports OpenGL ES 3.1 Support for dynamic hardware tessellation & geometry shaders Samsung Galaxy Note 4 GPU highlights Richer, visually immersive graphics No Tessellation Tessellation
  • 74. 74 Samsung Galaxy Note 4 supports most advanced graphics APIs Feature/APIs OpenGL ES 3.0 OpenGL ES 3.1 Android Extension Pack Compute Shader No Yes Yes Atomics No Yes Yes Image Load/Store No Yes Yes Draw Indirect No Yes Yes Texture Gather No Yes Yes Multisample Textures No Yes Yes Stencil Textures No Yes Yes Separate Shader Objects No Yes Yes Advanced Blending Modes (Programmable Blending) No Yes Yes Geometry Shaders No No Yes Tessellation Shaders No No Yes
  • 75. 75 Improved architecture for performance & efficiency Better performance Reduced power consumption Samsung Galaxy Note 4 GPU highlights Direct Rendering Tiled Rendering Dynamic Switching Original ASTC Compression 24bpp 8bpp 3.56bpp 2bpp Unified Shaders Pixel | Vertex | Compute Tessellation | Geometry Adreno GPU System memory Adreno GPU System memory Tile buffer
  • 76. 76 GPU architecture Tiled Rendering architecture Advantages: Designed to minimize unnecessary data traffic to host memory Designed to minimize power consumption Use of transparency/anti-aliasing is inexpensive Objects in background Objects in foreground Advantages: • Designed to prevent unnecessary use of GPU resources in drawing pixels for occluded objects • Designed to increase overall graphics performance for larger scenes with opaque geometry Early Z (Depth) Reject feature
  • 77. 77 GPU architecture Adreno GPU System memory Direct rendering GMEM (Tile Buffer) Adreno GPU System memory Tiled rendering FlexRender Dynamic Switching 1X Speed for ā€œhighpā€ Shaders 2X Speed for ā€œmediumpā€ Shaders Dynamic FlexRender technology Advantages: Better performance and power for wider range of use cases More developer flexibility Advantages: • Use additional/complex shaders without compromising performance • Better performance with power efficiency Double Rate Half Precision (DRHP) design
  • 79. 79 Optimization: frame buffer objects Worst case pattern of FBO usage Frame buffer Clear Draw FBO 0 Draw Frame buffer Draw Store Store Load Load Store Frame rendering
  • 80. 80 Optimization: frame buffer objects Optimized render order Invalidate Framebuffer Draw Optimal rendering order: FBO0 invalidate, FBO0 draw … FBOn invalidate, FBOn draw, FB clear, FB draw Frame rendering Frame buffer Store Clear Draw FBO 0 Store
  • 81. 81 In the worst case the complete sequence of VBO updates and draw calls may have to be repeated for each bin Even when using glBufferSubData multiple copies of the entire VBO may need to be maintained by the driver Optimization: dynamic vertex buffer objects Worst case pattern of VBO usage Update VBO0 Update VBO0 Update VBO0Draw Draw Draw Frame rendering
  • 82. 82 Optimization: dynamic vertex buffer objects Optimized dynamic VBO order Or if multiple dynamic VBOs are used Update VBO0 Draw VBO0 Update VBO0 Update VBOn Draw VBO0 Draw VBOn Frame rendering Frame rendering
  • 83. 83 Sort by material āˆ’ Reduces shader and texture state changes Sort opaque draw calls front-to back āˆ’ Reduces time spent shading fragments which will be overwritten later āˆ’ Have observed > 10ms/frame performance increase in some fragment bound content with just this optimization. Draw the skybox last āˆ’ Typically the skybox is covered by foreground geometry in half or more of the screen Optimization: sorting Potential to reduce both the number of state changes as well as overdraw - both of which have a negative impact on GPU performance
  • 84. 84 Operations on 16 bit floating point (mediump) values are 2x faster than on 32 bit (highp) āˆ’ Recommend setting default precision to medium and promoting only values which require higher precision, E.g Optimization: shader performance Precision Adreno 3xx and 4xx GPUs utilize a scalar architecture Avoid using components that aren’t needed for the final result Wherever possible re-order operations to execute on as few components as possible Scalar architecture precision mediump float; // Set default precision in FS to fp16 out vec2 vSmallTexCoord; // Uses mediump out highp vec2 vLargeTexCoord; // Uses highp
  • 85. 85 High levels of tessellation can generate sub-pixel triangles which cause poor rasterizer utilization āˆ’ Very important to utilize distance, screen space size or other adaptive metrics for computing tessellation factors which avoid sub-pixel triangles Optimization: tessellation Tessellation allows for incredible levels of detail and can substantially reduce memory bandwidth and CPU cycles by allowing other game sub-systems to operate on low resolution representations of meshes, but … Full Rasterizer Utilization Partial Rasterizer Utilization
  • 86. 86 Hardware back-face culling occurs after the tessellation stage, which potentially wastes GPU resources tessellating back facing primitives Back-facing primitives can be identified in the TCS and culled by setting their edge tessellation factors to 0 āˆ’ A slight ā€œfudgeā€ factor may be needed in this calculation if displacement mapping will be used in the TES as this technique may change the visibility of primitives Optimization: tessellation Culling Whenever possible disable the TCS and TES stages if the tessellation factor for the mesh would be ~1 āˆ’ Eliminates the use of unnecessary GPU stages General
  • 88. 88 Graphics content development & tools Asset Creation Compress/ Optimize Code Emulate Compile Deploy Analyze/ Debug
  • 89. 89 Support for OpenGL ES 3.1, 3.0 & 2.0, DirectX, and OpenCL Supported on Windows, Mac OSX, and Linux Comprehensive collection of utilities Over 100 samples and tutorials Thorough documentation Adreno tools Adreno SDK Adreno Profiler Comprehensive profiling tool Supported on Windows, Mac OSX, and Linux Enables detailed analysis of GPU utilization Proven effective and easy to use Works with commercial devices & apps Available on developer.qualcomm.com Adreno SDK and Adreno Profiler and products of Qualcomm Technologies, inc.
  • 90. 90 Adreno Profiler: introduction Grapher mode: real-time analysisScrubber mode : detailed frame analysis API call stack Optimization suggestions Shader stats Shader editor Texture browser Detailed frame stats Overrides Metrics Frame emulation Scrubber metrics
  • 91. 91 Adreno Profiler demo Reign of Amiraā„¢ Available on Google Play Reign of Amira is a product of Qualcomm Technologies, Inc.
  • 92. 92 Adreno SDK Desktop OpenGL ES emulator āˆ’ Now supporting OpenGL ES 3.1 Over 100 samples and tutorials āˆ’ Simple tutorials to advanced demos āˆ’ Covers OpenGL ES 2.0 and 3.0, 3.1, AEP DirectX, and OpenCL Utilities and libraries āˆ’ Texture compression āˆ’ Mesh optimization Adreno texture tool Developer documentation āˆ’ Adreno Developer Guide Shader samples Animal materials (fur, elephant skin, fish scales, alligators, etc.) General lighting (ambient, diffuse, specular, Blinn-Phong, parallax, etc.) Human materials (skin, eye, etc.) Other effects (environment mapping, warping, glass distortion, god rays, etc.) Other materials (cloth, wood, plastic, marble, leather, metal, etc.) Advanced rendering (toon shading, deferred lighting, eye adaption, etc.)
  • 93. 93 Adreno SDK demo Reign of Amiraā„¢ Available on Google Play Reign of Amira is a product of Qualcomm Technologies, Inc.
  • 95. 95 For more information on Qualcomm, visit us at: www.qualcomm.com & www.qualcomm.com/blog Qualcomm is a trademark of Qualcomm Incorporated, registered in the United States and other countries. Other products and brand names may be trademarks or registered trademarks of their respective owners Thank you Follow us on: Ā©2013-2014 Qualcomm Technologies, Inc. and/or its affiliated companies. All Rights Reserved. Qualcomm, Snapdragon, Adreno, Gobi, Hexagon, FlexRender and Reign of Amira are trademarks of Qualcomm Incorporated, registered in the United States and other countries. Fast CV and Krait are trademarks of Qualcomm Incorporated. All Qualcomm Incorporated trademarks are used with permission. Other products and brand names may be trademarks or registered trademarks of their respective owners. References in this presentation to ā€œQualcommā€ may mean Qualcomm Incorporated, Qualcomm Technologies, Inc., and/or other subsidiaries or business units within the Qualcomm corporate structure, as applicable. Qualcomm Incorporated includes Qualcomm’s licensing business, QTL, and the vast majority of its patent portfolio. Qualcomm Technologies, Inc., a wholly-owned subsidiary of Qualcomm Incorporated, operates, along with its subsidiaries, substantially all of Qualcomm’s engineering, research and development functions, and substantially all of its product and services businesses, including its semiconductor business, QCT.