From e5fe2468e4673c086aab463bb281a8fa09b353ed Mon Sep 17 00:00:00 2001 From: Rich Slogar Date: Tue, 7 Jul 2015 12:17:02 -0700 Subject: docs: studio 1.3 allocation tracker Change-Id: I0cbca0d551c3f066f8fb532d7baf8603dab61112 --- docs/html/tools/debugging/debugging-memory.jd | 30 ++++++++++++++++++++-- .../tools/performance/allocation-tracker/index.jd | 15 +++++++---- docs/html/tools/performance/comparison.jd | 2 +- docs/html/tools/studio/index.jd | 24 +++++++++++++++++ 4 files changed, 63 insertions(+), 8 deletions(-) (limited to 'docs/html/tools') diff --git a/docs/html/tools/debugging/debugging-memory.jd b/docs/html/tools/debugging/debugging-memory.jd index fc9520a..fc4f4be 100644 --- a/docs/html/tools/debugging/debugging-memory.jd +++ b/docs/html/tools/debugging/debugging-memory.jd @@ -300,7 +300,33 @@ allocations that need to be done for that behavior, what thread they are on, and from. This is extremely valuable for tightening up these paths to reduce the work they need and improve the overall smoothness of the UI.

-

To use Allocation Tracker:

+

To use the Allocation Tracker, open the Memory Monitor in Android Studio and click the + +Allocation Tracker icon. You can also track allocations in the Android Device Monitor:

+ + +

Android Studio

+

To use the Allocation Tracker in +Android Studio:

+ +
    +
  1. Start your app on a connected device or emulator
  2. +
  3. Open the Android run-tme window, and view the free and allocated memory in the Memory + Monitor.
  4. +
  5. Click the Allocation Tracker icon + () in the Memory Monitor tool bar to start and stop memory + allocations. +

    Android Studio creates the allocation file with the filename + Allocations-yyyy.mm.dd-hh.mm.ss.alloc in the Captures tab.

    +
  6. +
  7. Double-click the allocation file to open the Allocation viewer.
  8. +
  9. Identify which actions in your app are likely causing too much allocation and determine where + in your app you should try to reduce allocations and release resources. +
+ + + +

Device Monitor

  1. Open the Device Monitor.

    From your <sdk>/tools/ directory, launch the monitor tool.

    @@ -641,7 +667,7 @@ hprof-conv heap-original.hprof heap-converted.hprof

    Note: If you're using the version of DDMS that's integrated into -Eclipse, you do not need to perform the HPROF conversion—DDMS performs the conversion by +Eclipse, you do not need to perform the HPROF conversation—it performs the conversion by default.

    You can now load the converted file in MAT or another heap analysis tool that understands diff --git a/docs/html/tools/performance/allocation-tracker/index.jd b/docs/html/tools/performance/allocation-tracker/index.jd index e71b584..d68f601 100644 --- a/docs/html/tools/performance/allocation-tracker/index.jd +++ b/docs/html/tools/performance/allocation-tracker/index.jd @@ -90,19 +90,24 @@ page.article=true alt="" width="400px" />

    - Figure 1. Steps for starting Allocation Tracker. + Figure 1. Steps for starting Allocation Tracker in Android DDMS.

  2. Connect your mobile device to your computer.
  3. -
  4. Open your application in Android Studio, build the source, and run it on your device.
  5. +
  6. Open your application in Android Studio, build the source, and run it on your device or + emulator.
  7. Click the Android button at the bottom of your Android Studio window.
  8. -
  9. Click the RECORD button +
  10. If you are using the Android Device Monitor, click the RECORD button - (Start Allocation Tracking tooltip).
  11. + (Start Allocation Tracking tooltip) in the Android DDMS tool bar. If you are using Android + Studio, click the + + icon in the Memory Monitor tool + bar.
  12. Interact with your application.
  13. @@ -119,7 +124,7 @@ page.article=true alt="" width="440px" />

    - Figure 2. Example of Allocation Tracker output. + Figure 2. Example of Allocation Tracker output in Android DDMS.

    diff --git a/docs/html/tools/performance/comparison.jd b/docs/html/tools/performance/comparison.jd index 0640717..f79e762 100644 --- a/docs/html/tools/performance/comparison.jd +++ b/docs/html/tools/performance/comparison.jd @@ -111,7 +111,7 @@ page.article=true

    Allocation Tracker

    -

    diff --git a/docs/html/tools/studio/index.jd b/docs/html/tools/studio/index.jd index bbb4edc..43cb2fe 100644 --- a/docs/html/tools/studio/index.jd +++ b/docs/html/tools/studio/index.jd @@ -226,6 +226,30 @@ snapshot in the Captures view and select Export to standard .hp +

    Allocation tracker

    +

    Android Studio allows you to track memory allocation as it monitors memory use. Tracking memory +allocation allows you to monitor where objects are being allocated when you perform certain actions. +Knowing these allocations enables you to adjust the method +calls related to those actions to optimize your app's performance and memory use.

    + + +

    Figure 6. Allocation tracker.

    + +

    Perform the following steps to track and analyze allocations:

    +
      +
    1. Click the Start/Stop Allocation Tracking icon + () in the + Memory Monitor. Android Studio starts tracking memory allocations.
    2. +
    3. Perform the tasks whose mallocs you want to track.
    4. +
    5. Click the Start/Stop Allocation Tracking icon again. Android Studio stops tracking mallocs + and saves the data to a file named Allocation-yyyy.mm.dd-hh.mm.ss.alloc. The + resulting file appears in the Captures tab.
    6. +
    7. Double-click the file to open it in the allocation viewer. +

      The allocation viewer allows you to view and analyze the allocations your app made while + running.

    8. +
    + +

    Data file access

    The Android SDK tools, such as Systrace, logcat, and -- cgit v1.1