android performance profiling concepts and tools...android performance profiling concepts and tools...
TRANSCRIPT
Android Performance Profiling Concepts and Tools
Karthik Hariharakrishnan Founder - GameBench
Multicore Challenge - 2014
Creators of the first ‘Usability’ testing infrastructure.
We objectively quantify ‘Usability’ (scores) of a device
Provide easy to use tools for visual analysis & optimization
Publish consumer data and rate devices
Who are we
Agenda
Performance profiling - Android • What does it mean?
App/Games Developer • How do I measure performance? • How do I measure system utilization? • What are the possible bottlenecks? • How do I detect them?
Challenges in Android • Optimizing for several 1000 devices
Performance Profiling
App Developer
• Fast Loading • Silky Smooth Transitions • Optimized memory usage • No stutters • Low Battery Usage
Game Developer • Consistent framerate • No stutters • Low battery usage
Memory
Memory Usage • How much memory does my app consume? • Will my app be killed? • How do I measure?
Dalvik • Memory allocated by Java
Native • Memory allocated by native code (C/C++)
Other • Memory allocated by other frameworks
Measure Memory
Interpreting log messages - Logcat • Printed during GC (Garbage Collection)
View Heap updates - DDMS • View app heap • Force GC and look at memory cleared
Track allocations - DDMS • Track allocations when interacting with App • Identify (un-necessary)memory allocations
Heap Dump Dump entire app heap and analyse references kept
Tracking Allocations
Performance
Frames per second (FPS) • Time taken to draw one frame • Modern devices have 60 Hz display • 16 ms to draw one frame
Stutters • Dropping a frame suddenly • Eg - Sequence of frames 16 – 16 – 32 – 16 - 16
Measure • Using getTimeOfDay • adb shell dumpsys gfxinfo <app>
• Gives the timestamps of last n frames • Use vendor specific tools
Battery Consumption
Is my app a battery killer? • Measure battery usage during a 10 min run • Use Android Battery API’s
What is the apps resource utilization? • What is the CPU Clocked at? • What is the GPU clocked at? • Am I effectively threaded?
CPU Usage
What is my app’s CPU consumption • Android reports aggregate usage in multi-core systems • Invariant to CPU Clocking governors • Measure using /proc/stat and /proc/{pid}/stat
How do my threads behave? • Measure using /proc/ filesystem
How are the different CPU Cores clocked?
• Linux kernel uses CPU Freq • Various “sysfs” points that can be used to measure CPU Core behavior
GPU Usage – Games Only
What is my app’s GPU Utilization? • No standard • Various GPU Vendors (ARM, IMG, Qcom, Nvidia etc)
Is my game – • CPU Bound ? • GPU Bound (Vertex / Fragment) ? • Bandwidth Bound ?
Vendor Tools
• Mali Streamline
• Nvidia Perf Hud ES • Adreno Profiler • PVR Scope
Android Fragmentation
How do I test for > 10 devices • Atleast 4000 unique Android devices • 200 – 300 popular ones
Solution • Upload application to testing cloud • Run tests on many devices at once
Unified dashboard for all data analysis
Precise analysis of individual sessions, but also the averaging out of hundreds of sessions, to get an unparalleled overview of the ecosystem
Data metrics pushed to a sophisticated web dashboard for in-depth visualizations
Dev 1 Dev 2 Dev 3 Dev 4 Dev 5 Dev 6
Questions