
Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Android Debugging and Performance AnalysisAnalysisPerformance 1 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... CC-BY-SA 3.0 - Attribution requirements and misc., PLEASE READ: This slide must remain as-is in this specific location (slide #1), everything else you are free to change; including the logo :-) Use of figures in other documents must feature the below "Originals at" URL immediately under that figure and the below copyright notice where appropriate. You are FORBIDDEN from using the default "About" slide as-is or any of its contents. Copyright (C) 2013-2014, Opersys inc. These slides created by: Karim Yaghmour Originals at: http://www.opersys.com/training/ 2 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... AboutAbout Introduced Linux Trace Toolkit in 1999 Originated Adeos and relayfs (kernel/relay.c) Training, Custom Dev, Consulting, ... 3 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... About this specific class Android debugging is dirty business AOSP version used by BSP has issues ... ergo ......... Runtime adjustments will be made 4 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Goals - High LevelLevelGoals Understand the set of debugging and performance monitoring tools and capabilities available in Android Understand the internals and limitations of each Get hands-on experience with the tools and capabilities Determine which ones are most appropriate, useful and/or important for a given task 5 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... GGooaallss -- SSppeecciiffiiccss Understand the Android stack's debugging mechanisms and their internals Debug from the app level all the way down to kernel drivers Using Linux debugging tools with Android Learning about Android-specific tools Monitor performance and latencies Quantify and analyze memory usage Breakpoint and step through the stack Apply commonly-used techniques for framework debugging Familiarize with lesser-known tools and capabilities built into Android HHAANNDDSS OONN 6 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... PrerequisitesPrerequisites C/C++ Java Linux command line Android internals Linux kernel internals Linux device drivers ARM architecture 7 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... TopicsTopics 1. Internals Architecture Quick Recap 2. Working with the AOSP Sources 3. Classifying and Analyzing Tools 4. Kernel Tools and Capabilities 5. Android-Agnostic User-Space Tools 6. Android-Specific User-Space Tools 7. Dalvik Tools 8. System Services Interfacing 9. Other Tools and Techniques 10. glibc User-Space 8 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... CoursewareCourseware These slides Exercises Online documentation "Use the Source, Luke, use the Source. Be one with the code." -- Linus Torvalds 9 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Hands-On Environment HostHost Ubuntu-based system 50GB / AOSP TargetTarget IFC6410 Qualcomm Snapdragon S4 Pro – APQ8064 Krait CPU, 4-core, 1.7 GHz, 2MB L2 cache 2 GB on-board DDR3 (PCDDR 533MHz) 4 GB eMMC Separate power/usb Requires monitor/keyboard/mouse 10 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Internals Architecture Quick Recap Hardware used to run Android AOSP Binder System Services HAL Call walkthrough System startup Debug setup Network boot Symbolic debugging 11 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 1. Hardware used to run Android 12 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 13 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 22.. AAOOSSPP 14 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 33.. BBiinnddeerr 15 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 44.. SSyysstteemm SSeerrvviicceess 16 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 55.. HHAALL 17 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 66.. CCaallll wwaallkktthhrroouugghh 18 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 77.. SSyysstteemm ssttaarrttuupp 19 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 88.. DDeebbuugg sseettuupp 20 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 99.. NNeettwwoorrkk bboooott 21 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 10. Symbolic debugging 22 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Working with the AOSP Sources 1. Basics 2. Preparing for Eclipse import 3. Importing into Eclipse 4. Fixing AOSP for Eclipse 5. Browsing the sources 23 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 1. BasicsBasics1. repo build/envsetup.sh godir croot mm m jgrep cgrep resgrep hmm lunch make -j8 24 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 2. Preparing for Eclipse import AOSP: Get AOSP ... from Google or otherwise Extract if needed Configure, build, etc. Eclipse / ADT: Get ADT bundle from developer.android.com Extract Start and update and if needed 25 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Set up basic classpath file: [aosp]$ cp development/ide/eclipse/.classpath . Adjust eclipse.ini: On my ADT bundle, it's: adt-bundle-linux-x86_64-20130917/eclipse/eclipse.ini Change this: -XX:MaxPermSize=256m -Xms40m -Xmx768m To this: -XX:MaxPermSize=256m -Xms128m -Xmx1500m 26 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 3. Importing into Eclipse Start Eclipse Create new "Java project": Project name = your AOSP name Deselect "Use default location" Location = path to your AOSP Click "Next" Wait a little bit ... Click "Finish" Wait for it to build your project (or select "Build Project") ... it likely will fail ... 27 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 4. Fixing AOSP for Eclipse Need to fix AOSP classpath file and sources Fixes tend to be very AOSP-specific Recipe is different each time Sometimes fixes are trivial, sometimes they aren't Assuming IFC6410 BSP 1.5 28 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Comment out a couple of things: <!-- <classpathentry kind="src" path="packages/apps/Bluetooth/src"/> --> <!-- <classpathentry kind="src" path="packages/apps/Camera/src"/> --> <!-- <classpathentry kind="src" path="packages/apps/Contacts/src"/> -- <!-- <classpathentry kind="src" path="packages/apps/Gallery2/src"/> <classpathentry kind="src" path="packages/apps/Gallery2/src_pd"/> <classpathentry kind="src" path="packages/apps/Gallery2/gallerycommon/src"/> --> <!-- <classpathentry kind="src" path="packages/apps/Phone/src"/> --> <!-- <classpathentry kind="src" path="packages/apps/Settings/src"/> --> <!-- <classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar"/> <classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar"/> --> 29 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Move frameworks/base/core/java/com/qualcomm/util: $ cd frameworks/base/core/java/com/qualcomm/ $ mkdir snapdragon $ mv util/ snapdragon/ Now: right-click on project and select "Refresh" You might need to manually click on Project->Build Project It might still show "x" on some parts until it's done rebuilding the project 30 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... 5. Browsing the Sources Mouse-over object type to be taken to declaration Browse classes through “Outline” Browse Call Hierarchy View recently viewed files (Ctrl-e) Many other shortcuts, see: http://source.android.com/source/using-eclipse.html Issues: Can't compile with Eclipse ... still need “make” For Java only 31 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Classifying and Analyzing Tools Families of tools available in Linux/Android Use of sampling Use of software breakpoints Use of interrupts Ability to understand machine code Ability to read into internal data structures Use of statistics Use of buffering Time measurement Limitations Documentation vs. capabilities 32 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi... Kernel Tools and Capabilities 1. Basic interfacing 2. Instrumentation 3. Analysis tools 4. Debugging 33 of 173 14-05-21 10:08 PM Android Debugging and Performance Analysis file:///home/karim/opersys-dev/courseware/androi..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages173 Page
-
File Size-