SlideShare a Scribd company logo
1 of 24
Download to read offline
We design and develop great
software for mobile and web.
Profiling with Traceview
and dmtracedump
Željko Plesac
Android talks #9
Scope
• Traceview
• dmtracedump
• StrictMode
• Real world example
Profiling (1)
• form of dynamic program analysis that measures,
for example, the space (memory) or time
complexity of a program, the usage of particular
instructions, or the frequency and duration of
function calls.
• Most commonly, profiling information serves to aid
program optimisation.
Profiling(2)
• It is very important for Android applications to
perform all operations as fast as possible.
• if your application is has long execution time and
everything else fails, you’ll need to use profiling
to debug those nasty errors and bugs
Profiling(3)
• 2 programs which come bundled in Android SDK:
1. Traceview
2. dmtracedump
Trace files(1)
• to use profiling, we first need to generate log files
containing the trace information you want to
analyse.
• two ways:
1. Use Debug class
2. Use the method profiling feature of DDMS
to generate trace logs (less precise)
Trace files(2)
• Include the Debug class in your code and call its
methods such as startMethodTracing() and
stopMethodTracing(), to start and stop logging of
trace information to disk.
• your application must have permission to write to
external storage
Traceview(1)
• graphical viewer for execution logs that you create by using
the Debug class to log tracing information in your code
• can help you debug your application and profile its
performance
• two layouts
1. Timeline panel - describes when each thread
and method started and stopped
2. Profile panel - provides a summary of what
happened inside a method
Traceview(2) - Timeline panel
Each thread’s execution is shown in its own row, with time
increasing to the right. The thin lines underneath the first row
show the extent (entry to exit) of all the calls to the selected
method.
Traceview(3) - profile panel
Traceview(4)
• table shows both the inclusive and exclusive times
(as well as the percentage of the total time):
1. exclusive time - time spent in the method
2. inclusive time - time spent in the method
plus the time spent in any called functions
• The last column in the table shows the number of
calls to this method plus the number of recursive
calls
dmtracedump
• generates the call stack data as a tree diagram,
with each call represented as a node.
• it shows call flow (from parent node to child nodes)
using arrows
• Graphviz Dot utility is needed to create graphical
output
dmtracedump(2)
each node, dmtracedump shows <ref> callname (<inc-ms>,
<exc-ms>,<numcalls>)
Strict mode(1)
• You should avoid performing long running
operations on the UI thread. This includes file and
network access.
• StrictMode you can instruct the Android system to
crash your application if it performs long running
operations, e.g. I/O in the user interface thread.
Strict mode(2)
Real world example
Real world example
• client reported that application has long startup
time on Samsung devices
• tested on Samsung Galaxy Tab 2.0. - startup time is
longer than 25 seconds
• firstly we scanned the app with StrictMode - no
long running operations were found on the UI
thread
• secondly, we optimised ActiveAndroid ORM
library by manually specifying database models in
Android manifest
• with this step we optimised app startup by 4
seconds
• after that debugging didn’t help, so we needed to
use profiling
Traceview
dmtracedump
• after examining the tracefile, we noticed strange
behaviour with MagicViews external library
• turns out that this library scans all asset folders
(either our application or external dependencies
assets) looking for custom fonts
• after replacing MagicViews with custom
implementation of UI elements, we downgraded the
app startup time to less than 2 seconds
Conclusion
• Profiling is something we usually use as a last
resort
• it will not automatically fix all of your problems,
but it’ll just give you a brief insight to your
application behaviour
• TraceView is deprecated - use Android Device
Monitor (tools/monitor) instead

More Related Content

What's hot (19)

Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptx
 
Homework solutionsch9
Homework solutionsch9Homework solutionsch9
Homework solutionsch9
 
Session 7
Session 7Session 7
Session 7
 
Real Time System
Real Time SystemReal Time System
Real Time System
 
Real time-system
Real time-systemReal time-system
Real time-system
 
Mutual exclusion and sync
Mutual exclusion and syncMutual exclusion and sync
Mutual exclusion and sync
 
Complexity Analysis
Complexity Analysis Complexity Analysis
Complexity Analysis
 
Real time systems 1 and 2
Real time systems 1 and 2Real time systems 1 and 2
Real time systems 1 and 2
 
Os prj ppt
Os prj pptOs prj ppt
Os prj ppt
 
Cpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using javaCpu scheduling algorithms simulation using java
Cpu scheduling algorithms simulation using java
 
Android activity
Android activityAndroid activity
Android activity
 
OPERATING SYSTEM-"Scheduling policies"
OPERATING SYSTEM-"Scheduling policies"OPERATING SYSTEM-"Scheduling policies"
OPERATING SYSTEM-"Scheduling policies"
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
Real time-embedded-system-lec-04
Real time-embedded-system-lec-04Real time-embedded-system-lec-04
Real time-embedded-system-lec-04
 
Real time-embedded-system-lec-02
Real time-embedded-system-lec-02Real time-embedded-system-lec-02
Real time-embedded-system-lec-02
 
Demo
DemoDemo
Demo
 
Real time-embedded-system-lec-05
Real time-embedded-system-lec-05Real time-embedded-system-lec-05
Real time-embedded-system-lec-05
 
Realtime systems chapter 1
Realtime systems chapter 1Realtime systems chapter 1
Realtime systems chapter 1
 
Addressing modes examples and subroutines
Addressing modes examples and subroutinesAddressing modes examples and subroutines
Addressing modes examples and subroutines
 

Similar to Android talks #08 android profiling

Design Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise SolutionsDesign Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise SolutionsInductive Automation
 
Design Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise SolutionsDesign Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise SolutionsInductive Automation
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPLnitinscribd
 
What’s eating python performance
What’s eating python performanceWhat’s eating python performance
What’s eating python performancePiotr Przymus
 
Lab 1 reference manual
Lab 1 reference manualLab 1 reference manual
Lab 1 reference manualtrayyoo
 
Class5_DataloggerProgrammingArduino.pptx
Class5_DataloggerProgrammingArduino.pptxClass5_DataloggerProgrammingArduino.pptx
Class5_DataloggerProgrammingArduino.pptxHebaEng
 
Peddle the Pedal to the Metal
Peddle the Pedal to the MetalPeddle the Pedal to the Metal
Peddle the Pedal to the MetalC4Media
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slotsmha4
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slotsmha4
 
Operating System Slides 1.pptx
Operating System Slides 1.pptxOperating System Slides 1.pptx
Operating System Slides 1.pptxDureshehwarArshad
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statementsankurkhanna
 
[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background ThreadsNikmesoft Ltd
 
HiPEAC 2019 Tutorial - Maestro RTOS
HiPEAC 2019 Tutorial - Maestro RTOSHiPEAC 2019 Tutorial - Maestro RTOS
HiPEAC 2019 Tutorial - Maestro RTOSTulipp. Eu
 
TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012Ashish Bhasin
 
C program execution and algorithm
C program execution and algorithm C program execution and algorithm
C program execution and algorithm Kunal Pandhram
 

Similar to Android talks #08 android profiling (20)

Design Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise SolutionsDesign Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise Solutions
 
Design Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise SolutionsDesign Like a Pro: Planning Enterprise Solutions
Design Like a Pro: Planning Enterprise Solutions
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPL
 
01CHAP_1.PPT
01CHAP_1.PPT01CHAP_1.PPT
01CHAP_1.PPT
 
What’s eating python performance
What’s eating python performanceWhat’s eating python performance
What’s eating python performance
 
Lab 1 reference manual
Lab 1 reference manualLab 1 reference manual
Lab 1 reference manual
 
Class5_DataloggerProgrammingArduino.pptx
Class5_DataloggerProgrammingArduino.pptxClass5_DataloggerProgrammingArduino.pptx
Class5_DataloggerProgrammingArduino.pptx
 
Unix commands
Unix commandsUnix commands
Unix commands
 
Peddle the Pedal to the Metal
Peddle the Pedal to the MetalPeddle the Pedal to the Metal
Peddle the Pedal to the Metal
 
Documentation
DocumentationDocumentation
Documentation
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
 
04 threads-pbl-2-slots
04 threads-pbl-2-slots04 threads-pbl-2-slots
04 threads-pbl-2-slots
 
master_seminar
master_seminarmaster_seminar
master_seminar
 
0903 1
0903 10903 1
0903 1
 
Operating System Slides 1.pptx
Operating System Slides 1.pptxOperating System Slides 1.pptx
Operating System Slides 1.pptx
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statements
 
[iOS] Multiple Background Threads
[iOS] Multiple Background Threads[iOS] Multiple Background Threads
[iOS] Multiple Background Threads
 
HiPEAC 2019 Tutorial - Maestro RTOS
HiPEAC 2019 Tutorial - Maestro RTOSHiPEAC 2019 Tutorial - Maestro RTOS
HiPEAC 2019 Tutorial - Maestro RTOS
 
TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012
 
C program execution and algorithm
C program execution and algorithm C program execution and algorithm
C program execution and algorithm
 

More from Infinum

Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...Infinum
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum
 
Infinum Android Talks #20 - Benefits of using Kotlin
Infinum Android Talks #20 - Benefits of using KotlinInfinum Android Talks #20 - Benefits of using Kotlin
Infinum Android Talks #20 - Benefits of using KotlinInfinum
 
Infinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making our VIPER more reactiveInfinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making our VIPER more reactiveInfinum
 
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...Infinum
 
Infinum Android Talks #13 - Using ViewDragHelper
Infinum Android Talks #13 - Using ViewDragHelperInfinum Android Talks #13 - Using ViewDragHelper
Infinum Android Talks #13 - Using ViewDragHelperInfinum
 
Infinum Android Talks #14 - Log4j
Infinum Android Talks #14 - Log4jInfinum Android Talks #14 - Log4j
Infinum Android Talks #14 - Log4jInfinum
 
Infinum Android Talks #9 - Making your app location-aware
Infinum Android Talks #9 - Making your app location-awareInfinum Android Talks #9 - Making your app location-aware
Infinum Android Talks #9 - Making your app location-awareInfinum
 
Infinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle pluginsInfinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle pluginsInfinum
 
Infinum Android Talks #14 - Facebook for Android API
Infinum Android Talks #14 - Facebook for Android APIInfinum Android Talks #14 - Facebook for Android API
Infinum Android Talks #14 - Facebook for Android APIInfinum
 
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...Infinum
 
Infinum Android Talks #18 - Create fun lists by Ivan Marić
Infinum Android Talks #18 - Create fun lists by Ivan MarićInfinum Android Talks #18 - Create fun lists by Ivan Marić
Infinum Android Talks #18 - Create fun lists by Ivan MarićInfinum
 
Infinum Android Talks #18 - In-app billing by Ivan Marić
Infinum Android Talks #18 - In-app billing by Ivan MarićInfinum Android Talks #18 - In-app billing by Ivan Marić
Infinum Android Talks #18 - In-app billing by Ivan MarićInfinum
 
Infinum Android Talks #18 - How to cache like a boss by Željko Plesac
Infinum Android Talks #18 - How to cache like a boss by Željko PlesacInfinum Android Talks #18 - How to cache like a boss by Željko Plesac
Infinum Android Talks #18 - How to cache like a boss by Željko PlesacInfinum
 
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan VujaklijaInfinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan VujaklijaInfinum
 
Infinum iOS Talks #2 - Xamarin by Ivan Đikić
Infinum iOS Talks #2 - Xamarin by Ivan ĐikićInfinum iOS Talks #2 - Xamarin by Ivan Đikić
Infinum iOS Talks #2 - Xamarin by Ivan ĐikićInfinum
 
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho PolutaInfinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho PolutaInfinum
 
Infinum iOS Talks #1 - Swift done right by Ivan Dikic
Infinum iOS Talks #1 - Swift done right by Ivan DikicInfinum iOS Talks #1 - Swift done right by Ivan Dikic
Infinum iOS Talks #1 - Swift done right by Ivan DikicInfinum
 
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran BurojevicInfinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran BurojevicInfinum
 
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum
 

More from Infinum (20)

Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtil
 
Infinum Android Talks #20 - Benefits of using Kotlin
Infinum Android Talks #20 - Benefits of using KotlinInfinum Android Talks #20 - Benefits of using Kotlin
Infinum Android Talks #20 - Benefits of using Kotlin
 
Infinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making our VIPER more reactiveInfinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making our VIPER more reactive
 
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
 
Infinum Android Talks #13 - Using ViewDragHelper
Infinum Android Talks #13 - Using ViewDragHelperInfinum Android Talks #13 - Using ViewDragHelper
Infinum Android Talks #13 - Using ViewDragHelper
 
Infinum Android Talks #14 - Log4j
Infinum Android Talks #14 - Log4jInfinum Android Talks #14 - Log4j
Infinum Android Talks #14 - Log4j
 
Infinum Android Talks #9 - Making your app location-aware
Infinum Android Talks #9 - Making your app location-awareInfinum Android Talks #9 - Making your app location-aware
Infinum Android Talks #9 - Making your app location-aware
 
Infinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle pluginsInfinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle plugins
 
Infinum Android Talks #14 - Facebook for Android API
Infinum Android Talks #14 - Facebook for Android APIInfinum Android Talks #14 - Facebook for Android API
Infinum Android Talks #14 - Facebook for Android API
 
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
 
Infinum Android Talks #18 - Create fun lists by Ivan Marić
Infinum Android Talks #18 - Create fun lists by Ivan MarićInfinum Android Talks #18 - Create fun lists by Ivan Marić
Infinum Android Talks #18 - Create fun lists by Ivan Marić
 
Infinum Android Talks #18 - In-app billing by Ivan Marić
Infinum Android Talks #18 - In-app billing by Ivan MarićInfinum Android Talks #18 - In-app billing by Ivan Marić
Infinum Android Talks #18 - In-app billing by Ivan Marić
 
Infinum Android Talks #18 - How to cache like a boss by Željko Plesac
Infinum Android Talks #18 - How to cache like a boss by Željko PlesacInfinum Android Talks #18 - How to cache like a boss by Željko Plesac
Infinum Android Talks #18 - How to cache like a boss by Željko Plesac
 
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan VujaklijaInfinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
 
Infinum iOS Talks #2 - Xamarin by Ivan Đikić
Infinum iOS Talks #2 - Xamarin by Ivan ĐikićInfinum iOS Talks #2 - Xamarin by Ivan Đikić
Infinum iOS Talks #2 - Xamarin by Ivan Đikić
 
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho PolutaInfinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
 
Infinum iOS Talks #1 - Swift done right by Ivan Dikic
Infinum iOS Talks #1 - Swift done right by Ivan DikicInfinum iOS Talks #1 - Swift done right by Ivan Dikic
Infinum iOS Talks #1 - Swift done right by Ivan Dikic
 
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran BurojevicInfinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
 
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
 

Recently uploaded

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 

Recently uploaded (20)

CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

Android talks #08 android profiling

  • 1. We design and develop great software for mobile and web.
  • 2. Profiling with Traceview and dmtracedump Željko Plesac Android talks #9
  • 3. Scope • Traceview • dmtracedump • StrictMode • Real world example
  • 4. Profiling (1) • form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls. • Most commonly, profiling information serves to aid program optimisation.
  • 5. Profiling(2) • It is very important for Android applications to perform all operations as fast as possible. • if your application is has long execution time and everything else fails, you’ll need to use profiling to debug those nasty errors and bugs
  • 6. Profiling(3) • 2 programs which come bundled in Android SDK: 1. Traceview 2. dmtracedump
  • 7. Trace files(1) • to use profiling, we first need to generate log files containing the trace information you want to analyse. • two ways: 1. Use Debug class 2. Use the method profiling feature of DDMS to generate trace logs (less precise)
  • 8. Trace files(2) • Include the Debug class in your code and call its methods such as startMethodTracing() and stopMethodTracing(), to start and stop logging of trace information to disk. • your application must have permission to write to external storage
  • 9. Traceview(1) • graphical viewer for execution logs that you create by using the Debug class to log tracing information in your code • can help you debug your application and profile its performance • two layouts 1. Timeline panel - describes when each thread and method started and stopped 2. Profile panel - provides a summary of what happened inside a method
  • 10. Traceview(2) - Timeline panel Each thread’s execution is shown in its own row, with time increasing to the right. The thin lines underneath the first row show the extent (entry to exit) of all the calls to the selected method.
  • 12. Traceview(4) • table shows both the inclusive and exclusive times (as well as the percentage of the total time): 1. exclusive time - time spent in the method 2. inclusive time - time spent in the method plus the time spent in any called functions • The last column in the table shows the number of calls to this method plus the number of recursive calls
  • 13. dmtracedump • generates the call stack data as a tree diagram, with each call represented as a node. • it shows call flow (from parent node to child nodes) using arrows • Graphviz Dot utility is needed to create graphical output
  • 14. dmtracedump(2) each node, dmtracedump shows <ref> callname (<inc-ms>, <exc-ms>,<numcalls>)
  • 15. Strict mode(1) • You should avoid performing long running operations on the UI thread. This includes file and network access. • StrictMode you can instruct the Android system to crash your application if it performs long running operations, e.g. I/O in the user interface thread.
  • 18. Real world example • client reported that application has long startup time on Samsung devices • tested on Samsung Galaxy Tab 2.0. - startup time is longer than 25 seconds
  • 19. • firstly we scanned the app with StrictMode - no long running operations were found on the UI thread
  • 20. • secondly, we optimised ActiveAndroid ORM library by manually specifying database models in Android manifest • with this step we optimised app startup by 4 seconds • after that debugging didn’t help, so we needed to use profiling
  • 23. • after examining the tracefile, we noticed strange behaviour with MagicViews external library • turns out that this library scans all asset folders (either our application or external dependencies assets) looking for custom fonts • after replacing MagicViews with custom implementation of UI elements, we downgraded the app startup time to less than 2 seconds
  • 24. Conclusion • Profiling is something we usually use as a last resort • it will not automatically fix all of your problems, but it’ll just give you a brief insight to your application behaviour • TraceView is deprecated - use Android Device Monitor (tools/monitor) instead