SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline
Использование 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

Mais conteúdo relacionado

Destaque

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 sharingGabriella 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 statoGabriella 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
 
Getting Started Appendices may 14_2010
Getting Started Appendices may 14_2010Getting Started Appendices may 14_2010
Getting Started Appendices may 14_2010i4ppis
 
Introduction to descriptive writing
Introduction to descriptive writingIntroduction to descriptive writing
Introduction to descriptive writingenglishteacher-tnt
 

Destaque (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
 

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

Google I/O 2021 Recap
Google I/O 2021 RecapGoogle I/O 2021 Recap
Google I/O 2021 Recapfurusin
 
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 AppsLuis 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 2013Matt 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 2013Matt 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_finalNAVER 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 JetpackAhmad 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 ComponentsHassan 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 Applicationelliando dias
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development PracticesRoy 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 bigAndy Peterson
 
20200402 oracle cloud infrastructure data science
20200402 oracle cloud infrastructure data science20200402 oracle cloud infrastructure data science
20200402 oracle cloud infrastructure data scienceKenichi 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 PerformanceElif Boncuk
 
はじめての JFrog Artifactory
はじめての JFrog Artifactoryはじめての JFrog Artifactory
はじめての JFrog ArtifactoryTsuyoshi Miyake
 
WebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleWebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleJames 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
 

Semelhante a Использование 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?
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Использование 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