android code optimization techniques 3

19
RESTRICTED MORPHO MORPHO RESTRICTED This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho. Android Code Optimization Techniques (Session 3) 15/12/2014

Upload: ishrat-khan

Post on 11-Aug-2015

97 views

Category:

Software


2 download

TRANSCRIPT

RESTRICTED MORPHO

MORPHO RESTRICTEDThis document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

Android Code Optimization Techniques(Session 3) 15/12/2014

RESTRICTED MORPHO

MORPHO RESTRICTED

2 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

AGENDA

CONFIDENTIAL / February 2014 / CEE - CC India

Basic knowledge of DDMS (Dalvik Debug Monitor Service)

Practical with DDMS

RESTRICTED MORPHO

MORPHO RESTRICTEDThis document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

/01/Basics of DDMS

RESTRICTED MORPHO

MORPHO RESTRICTED

4 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

BASICS OF DDMS

CONFIDENTIAL / February 2014 / CEE - CC India

This is very very useful to the app developers

Its is a very powerful debugging tool environment and offers various unparalleled debugging features heap information logcat monitoring file manager Etc.

It is available by default in ECLIPSE IDE environment or even in the ANDROID SDK

RESTRICTED MORPHO

MORPHO RESTRICTEDThis document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

/02/HOW TO USE DDMS ??

RESTRICTED MORPHO

MORPHO RESTRICTED

6 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

HOW TO USE DDMS ??

As explained, install android sdk....After you have installed platform-tools & sdk tools.Now go to android folder and open tools

CONFIDENTIAL / February 2014 / CEE - CC India

NOW ANDROID DEBUG MONITOR WILL APPEAR ..

RESTRICTED MORPHO

MORPHO RESTRICTEDThis document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

/03/Now let's learn about its components and it's use's

RESTRICTED MORPHO

MORPHO RESTRICTED

8 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

DDMS VIEW COMPONENT'S :-

DEVICES :-

CONFIDENTIAL / February 2014 / CEE - CC India

The device panel shows the details of each process that are running in the connected device. There are various operations that can be performed from this panel.

RESTRICTED MORPHO

MORPHO RESTRICTED

9 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

ICONS

Each of the icons present in this panel performs the functions as follow's : Debug Process Icon :- It show's the state of connection of the debugger. Update Heap :-Clicking on this enables Heap information for the process so that we do not have to do

memory deallocation manually. Dump HPROF :- Generates a Heap Dump , useful for tracing memory leaks in your app. Cause GC :-Invokes the Garbage collector to collect heap data. Update thread :-Show's the information about the running thread in the thread tad for selected process Start Method Profiling :- Tracks the metric's related a method. It collects information like the amount of time

taken to execute a method, number of calls. Stop Process :-Stops the currently selected process. Screen Capture :- Takes a screenshot of whatever is displayed on the screen. Reset ADB :- As the name suggest, it resets ADB.

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTED

10 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

THREAD'S

The thread tab on the right of devices view shows informatiom related to the thread for each process selected in the devices view.The information shown can described as follows.

ID :- A unique ID assigned to each thread dby Dalvik V,, which are only odd numbers that start from 3 .

Tid :-The linux thread associated with each thread , ehich matches the process ID for each main thread in a process.

Status :- Status of the thread in VM , out of daemons are marked with an asterix.other values can be among running?sleeping/init/starting.

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTED

11 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

HEAP

the heap view show a information and statistics about memory heap .To view heap usage,follow these below steps

1. From the devices view, select the process for heap usage which has to be examined.

2. click on update heap

3. From heap Tab , select Cause GC to enable collecting heap data

Every time you need to update your heap statistics. This will show you the amount of memory allocated to each

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTED

12 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

ALLOCATION TRACKER

The allocation Tracker show a real time information about allocation happening in the application over a certain period of time. To enable allocation Tracking.

1. select the process to be tracked from device panel

2. click on start tracking from allocation tracker tab.

3. perform any actions on the devices or emulator that you want to be tracked.

4. click on Get Allocations objects, since tracking was enabled .

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTED

13 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

NETWORK STATISTICS

The network tab allows you to track and optimize the amount of network data your app is using. It even allows you to tag network sockets so that you can differentiate between types of data .It will indicate the speed and amount of data received /transmitted.

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTED

14 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

EMULATOR CONTROL :-

One problem with testing Android devices using an emulator or developer device is the fact that it is unable to examine the performance of the app in the real world conditions . like call or SMS is received/sent or when a particular location is reached. To be specific the emulator Tab allows you to emulate the following real world conditions :

Telephony Status :- the following options are available to set the status of phones network.Voice :- unregistered,home,roaming,searching,denied.Data :- unregistered,home,roaming,searching,denied.Speed :- Full,GSM,HSCSD,GPRS,EDGE,UMTS,HSDPA.Latency :- GPRS,UMTSTelephony Actions :- Telephony actions allow you to spoof the network.Location Settings ;- Emulator control allows you to sppof the location

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTED

15 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

FILE EXPLORER

As the name says it lets you view the directory and file structure if the device and lso easily copy files to and from the emulator so as to enable easy data transfer in a manner similiar to ADB or ADB pull command.

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTED

16 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

SYSTEM INFORMATION

As the name says , it give's us the particular information about the GPU load , CPU load....

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTED

17 /

This document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

DDMS HAS ALSO AN INBUILT LOGCAT VIEWER

CONFIDENTIAL / February 2014 / CEE - CC India

RESTRICTED MORPHO

MORPHO RESTRICTEDThis document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

• http://forum.xda-developers.com/showthread.php?t=2303834

• http://www.edumobile.org/android/android-tutorial/what-is-ddms-and-how-it-works/

References

RESTRICTED MORPHO

MORPHO RESTRICTEDThis document and the information therein are the property of Morpho, They must not be copied or communicated to a third party without the prior written authorization of Morpho.

Next session Android Studio - An official IDE for Android By Google.

Thank you