SlideShare a Scribd company logo
Использование debug утилит
  в разработке под Android



                     Антоненко Вячеслав
                            Android developer
                                     24.06.2011

                            1
Friday, July 1, 11
Утилиты


                     Memory Analyzer (MAT)
                          Traceview
                       Hierarchyviewer
                          Layoutopt
                            Logcat




Friday, July 1, 11
Поиск утечки памяти


                            Анализ логов
                        Причины утечки памяти
                           Memory Analyzer




Friday, July 1, 11
Анализ лога


            D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65%
             free 3571K/9991K, external 4703K/5261K, paused 2ms
                                    +2ms




Friday, July 1, 11
Анализ лога
          D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65%
          free 3571K/9991K, external 4703K/5261K, paused 2ms
          +2ms

          Причина GC
          •GC_CONCURRENT
          •GC_FOR_MALLOC
          •GC_EXTERNAL_ALLOC
          •GC_HPROF_DUMP_HEAP
          •GC_EXPLICIT




Friday, July 1, 11
Анализ лога
          D/dalvikvm( 3215): GC_CONCURRENT freed 2049K,
          65% free 3571K/9991K, external 4703K/5261K,
          paused 2ms+2ms

           Reason for GC
           Amount freed




Friday, July 1, 11
Анализ лога
          D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65%
          free 3571K/9991K, external 4703K/5261K, paused 2ms
          +2ms

           Reason for GC
           Amount freed
           Heap statistics




Friday, July 1, 11
Анализ лога
          D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65%
          free 3571K/9991K, external 4703K/5261K, paused 2ms
          +2ms

           Reason for GC
           Amount freed
           Heap statistics
           External memory statistics




Friday, July 1, 11
Анализ лога
          D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65%
          free 3571K/9991K, external 4703K/5261K, paused 2ms
          +2ms

           Reason for GC
           Amount freed
           Heap statistics
           External memory statistics
           Pause time




Friday, July 1, 11
Причины утечки памяти

                      Ссылки на не используемые объекты

                        Ссылки на Acitvity, Drawable, View

                     Долго живущие статические переменные

                       Не статические внутренние классы




Friday, July 1, 11
Получение дампа памяти

           Получение дампа
             –DDMS
             –android.os.Debug.dumpHprofData()
           Конвертация в стандартный HPROF
          формат
             –hprof-con dump.hprof converted_dump.hprof
           Анализ при помощи MAT



Friday, July 1, 11
Демонстрация примера
                         работы с MAT




Friday, July 1, 11
Friday, July 1, 11
Friday, July 1, 11
Оптимизация скорости
                      работы приложения


       Поиск узких мест в приложении

       Оптимизация пользовательских элементов управления




Friday, July 1, 11
Поиск «узких» мест в приложении



                         Утилиты:

                        Traceview
                     Режим StrictMode




Friday, July 1, 11
Использование Traceview
                            из Eclipse




Friday, July 1, 11
Использование Traceview
                             из кода

        android.os.Debug.startMethodTracing("trace_file_name");
            // your code is here
        android.os.Debug.stopMethodTracing();

        Необходимо установить разрешение на WRITE_EXTERNAL_STORAGE

        Получение trace из устройства

        adb pull /sdcard/trace_file_name.trace
        Traceview trace_file_name




Friday, July 1, 11
Режим StrictMode


        StrictMode.setThreadPolicy(
        new StrictMode.ThreadPolicy.Builder().detectAll()
        .penaltyLog().build());

        StrictMode.setVmPolicy(
        new StrictMode.VmPolicy.Builder().detectAll().
        penaltyLog().build());




Friday, July 1, 11
Friday, July 1, 11
…
        StrictMode(13858):
        at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:758)
             …
        StrictMode(13858):
        at com.softtechnics.mobiletalk.traceview.MobileTalkOptTraceViewActivity
        .onCreate(MobileTalkOptTraceViewActivity.java:25)
             …




Friday, July 1, 11
Оптимизация пользовательских
              элементов


        Утилиты

         hierarchyviewer
         layoutopt




Friday, July 1, 11
<?xml version="1.0" encoding="utf-8"?>
        <FrameLayout
             xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="match_parent">
             <View
                    android:layout_width="fill_parent"
                    android:layout_height="120dip"
                    android:background="@drawable/gradient_ligh_perfor_bg_bmp" />
             <RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:paddingLeft="20dip"
                    android:paddingRight="20dip"
                    android:paddingTop="55dip">
             <EditText
                    android:id="@+id/email"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:inputType="textEmailAddress"
                    android:background="@drawable/reg_pole"
                    android:hint="@string/hint_email"
                    android:textColorHint="#545353"
                    android:lines="1" />
                    //some code ...
             </RelativeLayout>
        </FrameLayout>




Friday, July 1, 11
Friday, July 1, 11
<?xml version="1.0" encoding="utf-8"?>
        <merge
             xmlns:android="http://schemas.android.com/apk/res/android">
             <View
                    android:layout_width="fill_parent"
                    android:layout_height="120dip"
                    android:background="@drawable/gradient_ligh_perfor_bg_bmp" />
             <RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:paddingLeft="20dip"
                    android:paddingRight="20dip"
                    android:paddingTop="55dip">
             <EditText
                    android:id="@+id/email"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:inputType="textEmailAddress"
                    android:background="@drawable/reg_pole"
                    android:hint="@string/hint_email"
                    android:textColorHint="#545353"
                    android:lines="1" />
                    //some code ...
             </RelativeLayout>
        </merge>




Friday, July 1, 11
Friday, July 1, 11
Использование Layoutopt

        layoutopt MobileTalkOptUI/res/layout/

        MobileTalkOptUI/res/layout/pay.xml
        31:607 This ScrollView layout or its LinearLayout parent is possibly useless
        36:606 This LinearLayout tag should use android:layout_height="wrap_content«
        78:91 This tag and its children can be replaced by one <TextView/> and a compound drawable
        118:130 This LinearLayout layout or its LinearLayout parent is useless
        129:129 Use an android:layout_height of 0dip instead of wrap_content for better performance
        148:161 This LinearLayout layout or its LinearLayout parent is useless
        160:160 Use an android:layout_height of 0dip instead of wrap_content for better performance

        MobileTalkOptUI/res/layout/main.xml




Friday, July 1, 11
Спасибо за внимание!




                                     ул. Михайловская 25
                                     Одесса 65005, Украина
                                     www.softtechnics.biz


Friday, July 1, 11

More Related Content

Viewers also liked

About this course final show
About this course final showAbout this course final show
About this course final show
englishteacher-tnt
 
Intervista a pablo pineda
Intervista a pablo pinedaIntervista a pablo pineda
Intervista a pablo pineda
Gabriella Giudici
 
Rassegna bibliografica su Michelstaedter
Rassegna bibliografica su MichelstaedterRassegna bibliografica su Michelstaedter
Rassegna bibliografica su MichelstaedterGabriella Giudici
 
Le trasformazioni di internet dopo la nascita del file sharing
Le trasformazioni di internet dopo la nascita del file sharingLe trasformazioni di internet dopo la nascita del file sharing
Le trasformazioni di internet dopo la nascita del file sharing
Gabriella Giudici
 
Cap17parr127 131 causa, generazione e definizione dello stato
Cap17parr127 131 causa, generazione e definizione dello statoCap17parr127 131 causa, generazione e definizione dello stato
Cap17parr127 131 causa, generazione e definizione dello stato
Gabriella Giudici
 
Jervis, Introduzione a Adorno et al, La Personalità autoritaria
Jervis, Introduzione a Adorno et al, La Personalità autoritaria Jervis, Introduzione a Adorno et al, La Personalità autoritaria
Jervis, Introduzione a Adorno et al, La Personalità autoritaria
Gabriella Giudici
 
Stella, DSA un'introduzione
Stella, DSA un'introduzioneStella, DSA un'introduzione
Stella, DSA un'introduzione
Gabriella Giudici
 
About this course
About this courseAbout this course
About this course
englishteacher-tnt
 
Getting Started Appendices may 14_2010
Getting Started Appendices may 14_2010Getting Started Appendices may 14_2010
Getting Started Appendices may 14_2010
i4ppis
 
Introduction to descriptive writing
Introduction to descriptive writingIntroduction to descriptive writing
Introduction to descriptive writing
englishteacher-tnt
 

Viewers also liked (10)

About this course final show
About this course final showAbout this course final show
About this course final show
 
Intervista a pablo pineda
Intervista a pablo pinedaIntervista a pablo pineda
Intervista a pablo pineda
 
Rassegna bibliografica su Michelstaedter
Rassegna bibliografica su MichelstaedterRassegna bibliografica su Michelstaedter
Rassegna bibliografica su Michelstaedter
 
Le trasformazioni di internet dopo la nascita del file sharing
Le trasformazioni di internet dopo la nascita del file sharingLe trasformazioni di internet dopo la nascita del file sharing
Le trasformazioni di internet dopo la nascita del file sharing
 
Cap17parr127 131 causa, generazione e definizione dello stato
Cap17parr127 131 causa, generazione e definizione dello statoCap17parr127 131 causa, generazione e definizione dello stato
Cap17parr127 131 causa, generazione e definizione dello stato
 
Jervis, Introduzione a Adorno et al, La Personalità autoritaria
Jervis, Introduzione a Adorno et al, La Personalità autoritaria Jervis, Introduzione a Adorno et al, La Personalità autoritaria
Jervis, Introduzione a Adorno et al, La Personalità autoritaria
 
Stella, DSA un'introduzione
Stella, DSA un'introduzioneStella, DSA un'introduzione
Stella, DSA un'introduzione
 
About this course
About this courseAbout this course
About this course
 
Getting Started Appendices may 14_2010
Getting Started Appendices may 14_2010Getting Started Appendices may 14_2010
Getting Started Appendices may 14_2010
 
Introduction to descriptive writing
Introduction to descriptive writingIntroduction to descriptive writing
Introduction to descriptive writing
 

Similar to Использование Debug утилит в разработке под Android

Google I/O 2021 Recap
Google I/O 2021 RecapGoogle I/O 2021 Recap
Google I/O 2021 Recap
furusin
 
Core Android
Core AndroidCore Android
Core Android
Dominik Helleberg
 
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
Using Automatic Refactoring to Improve Energy Efficiency of Android AppsUsing Automatic Refactoring to Improve Energy Efficiency of Android Apps
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
Luis Cruz
 
Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013
Matt Raible
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013
Matt Raible
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
NAVER D2
 
XML-Free Programming : Java Server and Client Development without &lt;>
XML-Free Programming : Java Server and Client Development without &lt;>XML-Free Programming : Java Server and Client Development without &lt;>
XML-Free Programming : Java Server and Client Development without &lt;>
Arun Gupta
 
The Best Way to Become an Android Developer Expert with Android Jetpack
The Best Way to Become an Android Developer Expert  with Android JetpackThe Best Way to Become an Android Developer Expert  with Android Jetpack
The Best Way to Become an Android Developer Expert with Android Jetpack
Ahmad Arif Faizin
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
Hassan Abid
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
elliando dias
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
Roy Clarkson
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
Andy Peterson
 
20200402 oracle cloud infrastructure data science
20200402 oracle cloud infrastructure data science20200402 oracle cloud infrastructure data science
20200402 oracle cloud infrastructure data science
Kenichi Sonoda
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
Brenda Cook
 
Optimizing Apps for Better Performance
Optimizing Apps for Better PerformanceOptimizing Apps for Better Performance
Optimizing Apps for Better Performance
Elif Boncuk
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
Renaud Boulard
 
Ruby conf2012
Ruby conf2012Ruby conf2012
Ruby conf2012
Chandan Jog
 
はじめての JFrog Artifactory
はじめての JFrog Artifactoryはじめての JFrog Artifactory
はじめての JFrog Artifactory
Tsuyoshi Miyake
 
WebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleWebLogic Deployment Plan Example
WebLogic Deployment Plan Example
James Bayer
 
Compile ahead of time. It's fine?
Compile ahead of time. It's fine?Compile ahead of time. It's fine?
Compile ahead of time. It's fine?
Dmitry Chuyko
 

Similar to Использование Debug утилит в разработке под Android (20)

Google I/O 2021 Recap
Google I/O 2021 RecapGoogle I/O 2021 Recap
Google I/O 2021 Recap
 
Core Android
Core AndroidCore Android
Core Android
 
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
Using Automatic Refactoring to Improve Energy Efficiency of Android AppsUsing Automatic Refactoring to Improve Energy Efficiency of Android Apps
Using Automatic Refactoring to Improve Energy Efficiency of Android Apps
 
Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013Play Framework vs Grails Smackdown - JavaOne 2013
Play Framework vs Grails Smackdown - JavaOne 2013
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
XML-Free Programming : Java Server and Client Development without &lt;>
XML-Free Programming : Java Server and Client Development without &lt;>XML-Free Programming : Java Server and Client Development without &lt;>
XML-Free Programming : Java Server and Client Development without &lt;>
 
The Best Way to Become an Android Developer Expert with Android Jetpack
The Best Way to Become an Android Developer Expert  with Android JetpackThe Best Way to Become an Android Developer Expert  with Android Jetpack
The Best Way to Become an Android Developer Expert with Android Jetpack
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
20200402 oracle cloud infrastructure data science
20200402 oracle cloud infrastructure data science20200402 oracle cloud infrastructure data science
20200402 oracle cloud infrastructure data science
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Optimizing Apps for Better Performance
Optimizing Apps for Better PerformanceOptimizing Apps for Better Performance
Optimizing Apps for Better Performance
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
 
Ruby conf2012
Ruby conf2012Ruby conf2012
Ruby conf2012
 
はじめての JFrog Artifactory
はじめての JFrog Artifactoryはじめての JFrog Artifactory
はじめての JFrog Artifactory
 
WebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleWebLogic Deployment Plan Example
WebLogic Deployment Plan Example
 
Compile ahead of time. It's fine?
Compile ahead of time. It's fine?Compile ahead of time. It's fine?
Compile ahead of time. It's fine?
 

Recently uploaded

“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 

Recently uploaded (20)

“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 

Использование Debug утилит в разработке под Android

  • 1. Использование debug утилит в разработке под Android Антоненко Вячеслав Android developer 24.06.2011 1 Friday, July 1, 11
  • 2. Утилиты Memory Analyzer (MAT) Traceview Hierarchyviewer Layoutopt Logcat Friday, July 1, 11
  • 3. Поиск утечки памяти  Анализ логов  Причины утечки памяти  Memory Analyzer Friday, July 1, 11
  • 4. Анализ лога D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65% free 3571K/9991K, external 4703K/5261K, paused 2ms +2ms Friday, July 1, 11
  • 5. Анализ лога D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65% free 3571K/9991K, external 4703K/5261K, paused 2ms +2ms Причина GC •GC_CONCURRENT •GC_FOR_MALLOC •GC_EXTERNAL_ALLOC •GC_HPROF_DUMP_HEAP •GC_EXPLICIT Friday, July 1, 11
  • 6. Анализ лога D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65% free 3571K/9991K, external 4703K/5261K, paused 2ms+2ms  Reason for GC  Amount freed Friday, July 1, 11
  • 7. Анализ лога D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65% free 3571K/9991K, external 4703K/5261K, paused 2ms +2ms  Reason for GC  Amount freed  Heap statistics Friday, July 1, 11
  • 8. Анализ лога D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65% free 3571K/9991K, external 4703K/5261K, paused 2ms +2ms  Reason for GC  Amount freed  Heap statistics  External memory statistics Friday, July 1, 11
  • 9. Анализ лога D/dalvikvm( 3215): GC_CONCURRENT freed 2049K, 65% free 3571K/9991K, external 4703K/5261K, paused 2ms +2ms  Reason for GC  Amount freed  Heap statistics  External memory statistics  Pause time Friday, July 1, 11
  • 10. Причины утечки памяти  Ссылки на не используемые объекты  Ссылки на Acitvity, Drawable, View  Долго живущие статические переменные  Не статические внутренние классы Friday, July 1, 11
  • 11. Получение дампа памяти  Получение дампа –DDMS –android.os.Debug.dumpHprofData()  Конвертация в стандартный HPROF формат –hprof-con dump.hprof converted_dump.hprof  Анализ при помощи MAT Friday, July 1, 11
  • 12. Демонстрация примера работы с MAT Friday, July 1, 11
  • 15. Оптимизация скорости работы приложения  Поиск узких мест в приложении  Оптимизация пользовательских элементов управления Friday, July 1, 11
  • 16. Поиск «узких» мест в приложении Утилиты:  Traceview Режим StrictMode Friday, July 1, 11
  • 17. Использование Traceview из Eclipse Friday, July 1, 11
  • 18. Использование Traceview из кода android.os.Debug.startMethodTracing("trace_file_name"); // your code is here android.os.Debug.stopMethodTracing(); Необходимо установить разрешение на WRITE_EXTERNAL_STORAGE Получение trace из устройства adb pull /sdcard/trace_file_name.trace Traceview trace_file_name Friday, July 1, 11
  • 19. Режим StrictMode StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder().detectAll() .penaltyLog().build()); StrictMode.setVmPolicy( new StrictMode.VmPolicy.Builder().detectAll(). penaltyLog().build()); Friday, July 1, 11
  • 21. StrictMode(13858): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:758) … StrictMode(13858): at com.softtechnics.mobiletalk.traceview.MobileTalkOptTraceViewActivity .onCreate(MobileTalkOptTraceViewActivity.java:25) … Friday, July 1, 11
  • 22. Оптимизация пользовательских элементов Утилиты  hierarchyviewer  layoutopt Friday, July 1, 11
  • 23. <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <View android:layout_width="fill_parent" android:layout_height="120dip" android:background="@drawable/gradient_ligh_perfor_bg_bmp" /> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="20dip" android:paddingRight="20dip" android:paddingTop="55dip"> <EditText android:id="@+id/email" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:inputType="textEmailAddress" android:background="@drawable/reg_pole" android:hint="@string/hint_email" android:textColorHint="#545353" android:lines="1" /> //some code ... </RelativeLayout> </FrameLayout> Friday, July 1, 11
  • 25. <?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <View android:layout_width="fill_parent" android:layout_height="120dip" android:background="@drawable/gradient_ligh_perfor_bg_bmp" /> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="20dip" android:paddingRight="20dip" android:paddingTop="55dip"> <EditText android:id="@+id/email" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:inputType="textEmailAddress" android:background="@drawable/reg_pole" android:hint="@string/hint_email" android:textColorHint="#545353" android:lines="1" /> //some code ... </RelativeLayout> </merge> Friday, July 1, 11
  • 27. Использование Layoutopt layoutopt MobileTalkOptUI/res/layout/ MobileTalkOptUI/res/layout/pay.xml 31:607 This ScrollView layout or its LinearLayout parent is possibly useless 36:606 This LinearLayout tag should use android:layout_height="wrap_content« 78:91 This tag and its children can be replaced by one <TextView/> and a compound drawable 118:130 This LinearLayout layout or its LinearLayout parent is useless 129:129 Use an android:layout_height of 0dip instead of wrap_content for better performance 148:161 This LinearLayout layout or its LinearLayout parent is useless 160:160 Use an android:layout_height of 0dip instead of wrap_content for better performance MobileTalkOptUI/res/layout/main.xml Friday, July 1, 11
  • 28. Спасибо за внимание! ул. Михайловская 25 Одесса 65005, Украина www.softtechnics.biz Friday, July 1, 11