diff --git a/docs/html/images/tools/am-androidmon2.png b/docs/html/images/tools/am-androidmon2.png new file mode 100644 index 0000000000000..a4a757193b09b Binary files /dev/null and b/docs/html/images/tools/am-androidmon2.png differ diff --git a/docs/html/images/tools/am-cpumon2.png b/docs/html/images/tools/am-cpumon2.png new file mode 100644 index 0000000000000..6ac6e0287a090 Binary files /dev/null and b/docs/html/images/tools/am-cpumon2.png differ diff --git a/docs/html/images/tools/am-dumpalloc2.png b/docs/html/images/tools/am-dumpalloc2.png new file mode 100644 index 0000000000000..d936aa82996f4 Binary files /dev/null and b/docs/html/images/tools/am-dumpalloc2.png differ diff --git a/docs/html/images/tools/am-gc2.png b/docs/html/images/tools/am-gc2.png new file mode 100644 index 0000000000000..a5e8b6e986d4f Binary files /dev/null and b/docs/html/images/tools/am-gc2.png differ diff --git a/docs/html/images/tools/am-gpumon2.png b/docs/html/images/tools/am-gpumon2.png new file mode 100644 index 0000000000000..5cf51d9320b29 Binary files /dev/null and b/docs/html/images/tools/am-gpumon2.png differ diff --git a/docs/html/images/tools/am-icaptures.png b/docs/html/images/tools/am-icaptures.png new file mode 100644 index 0000000000000..cf288d61bb9e1 Binary files /dev/null and b/docs/html/images/tools/am-icaptures.png differ diff --git a/docs/html/images/tools/am-igraphic.png b/docs/html/images/tools/am-igraphic.png new file mode 100644 index 0000000000000..a3c43fab5a310 Binary files /dev/null and b/docs/html/images/tools/am-igraphic.png differ diff --git a/docs/html/images/tools/am-imaximize.png b/docs/html/images/tools/am-imaximize.png new file mode 100644 index 0000000000000..38a6c6c6a6a6a Binary files /dev/null and b/docs/html/images/tools/am-imaximize.png differ diff --git a/docs/html/images/tools/am-imaxlogcat.png b/docs/html/images/tools/am-imaxlogcat.png new file mode 100644 index 0000000000000..4522bd4c6d31e Binary files /dev/null and b/docs/html/images/tools/am-imaxlogcat.png differ diff --git a/docs/html/images/tools/am-iminimize.png b/docs/html/images/tools/am-iminimize.png new file mode 100644 index 0000000000000..d0bbe4c0c4511 Binary files /dev/null and b/docs/html/images/tools/am-iminimize.png differ diff --git a/docs/html/images/tools/am-imovedown.png b/docs/html/images/tools/am-imovedown.png new file mode 100644 index 0000000000000..802c13b1ebdf9 Binary files /dev/null and b/docs/html/images/tools/am-imovedown.png differ diff --git a/docs/html/images/tools/am-imoveup.png b/docs/html/images/tools/am-imoveup.png new file mode 100644 index 0000000000000..95f6ef319f6f3 Binary files /dev/null and b/docs/html/images/tools/am-imoveup.png differ diff --git a/docs/html/images/tools/am-logcatmon2.png b/docs/html/images/tools/am-logcatmon2.png new file mode 100644 index 0000000000000..563593568f177 Binary files /dev/null and b/docs/html/images/tools/am-logcatmon2.png differ diff --git a/docs/html/images/tools/am-networkmon.png b/docs/html/images/tools/am-networkmon.png index 95b3a5b57f120..f55f853e51afd 100644 Binary files a/docs/html/images/tools/am-networkmon.png and b/docs/html/images/tools/am-networkmon.png differ diff --git a/docs/html/images/tools/am-networkmon2.png b/docs/html/images/tools/am-networkmon2.png new file mode 100644 index 0000000000000..d05fcd47cda8e Binary files /dev/null and b/docs/html/images/tools/am-networkmon2.png differ diff --git a/docs/html/images/tools/am-screenshot.png b/docs/html/images/tools/am-screenshot.png new file mode 100644 index 0000000000000..5c27617423605 Binary files /dev/null and b/docs/html/images/tools/am-screenshot.png differ diff --git a/docs/html/images/tools/am-sysinfo.png b/docs/html/images/tools/am-sysinfo.png new file mode 100644 index 0000000000000..9b5cd17207fb4 Binary files /dev/null and b/docs/html/images/tools/am-sysinfo.png differ diff --git a/docs/html/images/tools/am-video.png b/docs/html/images/tools/am-video.png new file mode 100644 index 0000000000000..9787ef87c670e Binary files /dev/null and b/docs/html/images/tools/am-video.png differ diff --git a/docs/html/jd_collections.js b/docs/html/jd_collections.js index 48c923d2f49fd..ecd374b73488e 100644 --- a/docs/html/jd_collections.js +++ b/docs/html/jd_collections.js @@ -1699,6 +1699,37 @@ var RESOURCE_COLLECTIONS = { "https://www.youtube.com/watch?v=j3QC6hcpy90" ] }, +"tools/help/log": { + "title": "", + "resources": [ + "tools/help/am-logcat.html" + ] + }, +"tools/help/monitor": { + "title": "", + "resources": [ + "tools/help/am-memory.html", + "tools/help/am-cpu.html", + "tools/help/am-gpu.html", + "tools/help/am-network.html" + ] + }, + "tools/help/data": { + "title": "", + "resources": [ + "tools/help/am-hprof.html", + "tools/help/am-allocation.html", + "tools/help/am-methodtrace.html", + "tools/help/am-sysinfo.html" + ] + }, + "tools/help/shot": { + "title": "", + "resources": [ + "tools/help/am-screenshot.html", + "tools/help/am-video.html" + ] + }, "tools/performance/rendering": { "title": "", "resources": [ diff --git a/docs/html/tools/help/am-allocation.jd b/docs/html/tools/help/am-allocation.jd new file mode 100644 index 0000000000000..20570c3be2e1c --- /dev/null +++ b/docs/html/tools/help/am-allocation.jd @@ -0,0 +1,220 @@ +page.title=Allocation Tracker +parent.title=Android Monitor +parent.link=android-monitor.html +meta.tags="android, performance, profiling, tools, monitor" +page.tags="android", "performance", "profiling", "tools", "monitor" +page.metaDescription=Use the Memory Monitor to capture allocation data about your app. The Allocation Tracker displays each method responsible for an allocation, as well as the allocation size and number of instances. +page.image=tools/help/thumbnails/am_alloctracker.png +page.article=true + +@jd:body + +
+
+

In this document

+
    +
  1. Understanding the Allocation Tracker Display
  2. +
  3. Taking and Displaying a Snapshot of Allocation Data
  4. +
  5. Viewing a Saved Allocation Tracking File
  6. +
  7. Sorting Allocation Data
  8. +
  9. Displaying Java Source
  10. +
  11. Working with Allocation Tracking Files
  12. +
+ +

See also

+
    +
  1. Managing Your App's Memory
  2. +
  3. Addressing Garbage Collection Issues
  4. +
  5. Investigating Your RAM Usage
  6. +
+ +
+
+ + + + +

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 app performance and memory use.

+ +

The Allocation Tracker does the following:

+ + + +

However, it takes time and experience to learn to interpret the output from this tool.

+ +

+ Understanding the Allocation Tracker Display +

+ +

+ The Allocation Tracker looks similar to the following figure: +

+ +

+ + +

The tool displays the following information:

+ + + + + + + + + + + + + + + + + + + + +
ColumnDescription
MethodThe Java method responsible for the allocation.
CountTotal number of instances allocated.
SizeThe total amount of allocated memory in bytes.
+ +

Taking and Displaying a Snapshot of Allocation Data

+ +

To examine allocation data:

+
    +
  1. Display a running app in the Memory + Monitor.
  2. +
  3. Click Start Allocation Tracking + Start Allocation Tracking icon.
  4. +
  5. Click Start Allocation Tracking + Start Allocation Tracking icon again to + deselect it and end the snapshot.
  6. + +

    The Memory Monitor displays the period when it took the snapshot. In the following + figure, you can see the snapshot period, as shown on the left. By comparison, when you dump the + Java heap, the Memory Monitor displays just the point where the heap snapshot was taken, as + shown on the right.

    + + +

    Android Studio creates the heap snapshot file with the + filename package_yyyy.mm.dd_hh.mm.ss.alloc using the activity package (or + project) name, year, month, day, + hour, minute, and second of the capture, for example, + com.android.calc_2015.11.17_14.58.48.alloc.

    + + The Allocation Tracker appears. +

    + +
  7. Optionally click the graphic icon graphic icon to display a visual representation of the data. +
  8. + + + + +
  9. Select the Group By menu option you want to display:
  10. + + +
+ + +

Viewing a Saved Allocation Tracking File

+

After you capture allocation data, Android Studio automatically stores it so +you can view it again.

+

To view an allocation tracking file in the Allocation Tracker:

+ + +
    +
  1. Click +Captures icon in the main window.
  2. + +

    Or select View > Tools Windows > +Captures.

    +

    The Captures window appears.

    +
  3. Open the Allocation Tracking folder.
  4. +
  5. Double-click the file to view it.
  6. +
+ +

Sorting Allocation Data

+ +

To sort allocation data:

+ + + +

Displaying Java Source

+

For some items displayed in the Allocation Tracker, you can view the Java source.

+

To display Java source:

+ + +

The source code appears in the Code Editor.

+ + +

Working with Allocation Tracking Files

+

You can rename, locate, and delete an allocation tracking file from within +Android Studio.

+ +

Renaming an allocation tracking file

+ +

If you rename a file from within Android Studio, it continues to appear in the Captures + window.

+

To rename an allocation tracking file:

+
    +
  1. In the Captures window, right-click the file and select Rename.
  2. +
  3. In the Rename dialog, specify the name of the file and click OK.
  4. +
+ + +

Locating an allocation tracking file

+

You can quickly discover where Android Studio stored allocation tracking files on disk.

+ + +

To locate an allocation tracking file from Android Studio:

+ + +

Note: If you move an allocation tracking file, Android Studio + no longer displays it in the Captures window. To display the file, use + File + > Open. Also, rename the file from the Captures + window and not in the operating system file browser.

+ +

Deleting an allocation tracking file

+ + +

To delete an allocation tracking file:

+ diff --git a/docs/html/tools/help/am-basics.jd b/docs/html/tools/help/am-basics.jd new file mode 100644 index 0000000000000..4bacecfe5136b --- /dev/null +++ b/docs/html/tools/help/am-basics.jd @@ -0,0 +1,329 @@ +page.title=Android Monitor Basics +parent.title=Android Monitor +parent.link=index.html +page.tags=monitor +@jd:body + +
+
+

In this document

+
    +
  1. Prerequisites and Dependencies
  2. +
  3. Displaying Android Monitor
  4. +
  5. Profiling a Running App in Android Monitor
  6. +
  7. Switching between Devices and Apps
  8. +
  9. Rearranging Android Monitor Windows
  10. +
  11. Terminating an App
  12. +
  13. Removing an App from a Device
  14. +
  15. Using Other Main Window Features
  16. +
+ + + + + +
+
+ +

+ Android Monitor has a main window that contains the logcat, Memory, CPU, GPU, and Network + Monitors. From this window, you can select a device and app process to work with, terminate an + app, collect dumpsys system information, and create screenshots and videos of the + running app. +

+ + +

+ Prerequisites and Dependencies +

+ +

+ Before you start using Android Monitor, you need to set up your environment, as well as the + hardware device or emulator. All of the monitors require the following: +

+ + +

+ All but the logcat Monitor have these additional requirements: +

+ + + +

+ The GPU Monitor has this requirement as well: +

+ +

+ The Network Monitor and the Video Capture tool work with a hardware device + only, not the emulator. +

+ + + +

+ Displaying Android Monitor +

+ +

+ Android Monitor is integrated into the Android Studio main window: +

+ + +

+ Note: If you don't see the sidebar buttons, you can + display them by selecting View > + Tool Buttons. +

+

+ Android Monitor looks like the following figure: +

+ + +

+ Profiling a Running App in Android Monitor +

+ +

+ After you've met the prerequisites and optionally connected a hardware device, you're ready + to profile an app in Android Monitor: +

+ +
    + +
  1. Open an app project and run the app on a device or + emulator. +
  2. + +
  3. Display Android Monitor and click the tab for the monitor you want to view. +
  4. +
  5. Follow the instructions about using the monitor: +
  6. + +
+

+ Switching between Devices and Apps +

+ +

+ By default, Android Monitor displays data for your most recently run app. You can switch to + another device and app as needed. In addition to currently running apps, you can view + information about apps that are no longer running so you can continue to see any information + about them that you gathered previously. +

+ +

+ At the top of the Android Monitor main window are two menus listing devices and processes. To + switch to another device, process, or both: +

+ +
    +
  1. Select the device or emulator. +
  2. + +

    + The Device menu lists the devices and emulators that are running or have run during your + current session. There are various status messages that can appear in the Device menu: +

    + + + +
  3. Select the process. +
  4. +

    + The Process menu lists the processes that are running or have run during your current session. If + a process is no longer running, the menu displays a status of DEAD. +

    +
+ + + + +

+ Rearranging Android Monitor Windows +

+ +

+ You can rearrange the Android Monitor windows for optimal viewing during your + tests: +

+ + +

+ To rearrange the logcat and Monitors tabs: +

+ + +

+ Terminating an App +

+ +

+ To stop an app you’ve run from Android Studio: +

+ +
    +
  1. + Select the device and the process in the Android Monitor + menus, if needed. +
  2. + +
  3. Click Terminate Application Terminate App icon. +
  4. + + +

    + The process status changes to DEAD in the Processes menu. The emulator or device + continues to run, but the app closes. Any running monitors in Android Monitor stop. +

    +
+ +

+ Removing an App from a Device +

+ +

+ To remove an app from a device you use for development, use the normal uninstall procedure on the + device. +

+ +

+ If you run a new version of an app from Android Studio that’s been already installed on a + hardware device, the device displays an Application Installation Failed dialog. Click + OK to install the new version of the app. +

+ +

+ Using Other Main Window Features +

+

+ From the Android Monitor main window, you can also do the following: +

+ + + diff --git a/docs/html/tools/help/am-cpu.jd b/docs/html/tools/help/am-cpu.jd index 62b35909a3151..420d6f8139ab2 100644 --- a/docs/html/tools/help/am-cpu.jd +++ b/docs/html/tools/help/am-cpu.jd @@ -1,7 +1,12 @@ page.title=CPU Monitor parent.title=Android Monitor parent.link=android-monitor.html -page.tags=monitor +meta.tags="android, performance, profiling, tools, monitor" +page.tags="android", "performance", "profiling", "tools", "monitor" +page.metaDescription=Use the CPU Monitor to display CPU usage in real time and the percentage of total CPU time (including all cores) used in user and kernel mode. +page.image=tools/help/thumbnails/am-cpumon.png +page.article=true + @jd:body
@@ -9,63 +14,9 @@ page.tags=monitor

In this document

  1. Displaying a Running App in the CPU Monitor
  2. -
  3. Performing a Method Trace in the CPU Monitor
  4. -
  5. Viewing a Saved Method Trace
  6. -
  7. Sorting Method Trace Data
  8. -
  9. Renaming a Method Trace File
  10. -
  11. Locating a Method Trace File on Disk
  12. -
  13. Deleting a Method Trace File
  14. +
  15. Recording Call Stack Changes
-

See also

-
    -
  1. - Android Monitor -
  2. -
  3. logcat Monitor -
  4. - -
  5. Memory Monitor -
  6. - -
  7. GPU Monitor -
  8. - -
  9. - Network Monitor -
  10. -
- - -

- Dependencies and Prerequisites -

- - -
@@ -73,253 +24,66 @@ page.tags=monitor

The CPU Monitor lets you easily monitor the central processing unit (CPU) usage of your app. It displays CPU usage in real time and displays the percentage of total CPU time (including all cores) - used by user and kernel mode. In user mode, the code must use system APIs to access hardware or - memory, and crashes are usually recoverable. In kernel mode, the code can directly access - hardware, including memory addresses; crashes halt the device. + used in user and kernel mode. In user mode, the code must use system APIs to access hardware or + memory, has access to virtual memory addresses only, and crashes are usually + recoverable. In kernel mode, the code can directly access + hardware, including physical memory addresses; crashes halt the device.

+

Displaying a Running App in the CPU Monitor

- Follow these steps: + To display an app running on a particular device or emulator in the CPU Monitor:

    -
  1. Optionally connect a hardware device. +
  2. Meet the prerequisites and dependencies.
  3. - -
  4. - Display Android Monitor. +
  5. Open an app project.
  6. - -
  7. Click the CPU tab. -
  8. - -
  9. Open an app project and run it on a hardware device or +
  10. Run the app on a hardware device or emulator.
  11. +
  12. + Display Android Monitor. +
  13. +
  14. Click the Monitors tab and display the CPU Monitor. +
  15. +
  16. Enable the CPU Monitor by clicking Pause Pause icon to deselect - it. + style="vertical-align:sub;margin:0;height:17px" alt="Pause icon" /> to deselect it.
  17. +

    The CPU Monitor starts to display any CPU usage. In the graph, the y-axis displays the percentage of CPU used. The x-axis records the time elapsed and starts with seconds, and then minutes and seconds, and so on.

    - +
  18. To stop the CPU Monitor, click Pause Pause icon again to select it.
- -

- Performing a Method Trace in the CPU Monitor +

+ Recording Call Stack Changes

- Follow these steps: -

- -
    -
  1. - Display a running app in the CPU - Monitor. -
  2. - -
  3. Start a trace by clicking Start Method Tracing Start Method Tracing icon to - select it. -
  4. - -
  5. To stop the trace, click Stop Method Tracing Stop Method Tracing icon to - deselect it. -
  6. - -

    - The method trace appears in the Code Editor area: -

    -Method Trace -

    - Android Studio creates the method trace file - with the filename Trace_yyyy.mm.dd_hh.mm.ss.trace - using the year, month, day, hour, minute, and second of the capture, for example, - Trace_2015.11.17_14.58.48.trace. -

    -
  7. Specify display options: - - -

    - The display shows the following information: -

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldDescription
    NameThe name of the method.
    Invocation CountHow many times the method was called.
    Inclusive Time (microseconds)Time spent in the method and all of its children, either wall clock or thread time, - depending on your selection in the x-axis menu.
    Exclusive Time (microseconds)Time spent just in the method (excluding time spent in its children), either wall clock - or thread time, depending on your selection in the x-axis menu.
    -

    Note: Running the method trace significantly affects CPU timings. - Use the method trace to understand the flow of the program, but not for performance timings.

    -

    - The graphic represents the wall clock or thread time for each method. Hover the cursor - over the display to receive information about the method. This information also appears - in the table. -

    -
-

- Viewing a Saved Method Trace -

- -

- After you do a method trace, Android Studio automatically stores it so you can view it - again. To examine the trace, follow these steps: -

- -
    -
  1. Click Captures in the main window. -
  2. - -

    - The Captures window appears. -

    - -
  3. Open the Methods Tracing folder. -
  4. - -
  5. Double-click the file to view it. -
  6. -
- -

- Sorting Method Trace Data -

- -

- You can sort the data by method name, count, inclusive time, and exclusive time. Follow this step: -

- - - - -

- Renaming a Method Trace File -

- -

- Rename a method trace file from within Android Studio so it - continues to appear in the Captures window. Follow these steps: -

- -
    -
  1. In the Captures window, right-click the file and select Rename. -
  2. - -
  3. In the dialog, specify the name of the file and click OK. -
  4. -
- -

- Locating a Method Trace File on Disk -

- -

- You can quickly discover where Android Studio stored method trace files on disk. Follow this step: + You can capture a record of the changes on the call stack during a particular + time period while the CPU Monitor is running. For more information, see + Method Trace.

- -

- Note: If you move a method trace file, Android Studio no longer displays the file - in the Captures window. To display it, use File > - Open. Also, rename a file from the Captures - window and not in the operating system file browser. -

- -

- Deleting a Method Trace File -

- -

- Follow this step in Android Studio: -

- - - -

- Android Studio deletes the file from the Captures dialog and from disk. -

\ No newline at end of file diff --git a/docs/html/tools/help/am-gpu.jd b/docs/html/tools/help/am-gpu.jd index a244b224d49d9..fb140ad8b9b2c 100644 --- a/docs/html/tools/help/am-gpu.jd +++ b/docs/html/tools/help/am-gpu.jd @@ -1,7 +1,12 @@ page.title=GPU Monitor parent.title=Android Monitor parent.link=android-monitor.html -page.tags=monitor +meta.tags="android, performance, profiling, tools, monitor" +page.tags="android", "performance", "profiling", "tools", "monitor" +page.metaDescription=Use the GPU Monitor for a visual representation of how much time it takes to render the frames of a UI window. Use this information to optimize the code that displays graphics and conserve memory. +page.image=tools/help/thumbnails/am-gpumon.png +page.article=true + @jd:body
@@ -11,59 +16,6 @@ page.tags=monitor
  • Displaying a Running App in the GPU Monitor
  • -

    See also

    -
      -
    1. - Android Monitor -
    2. -
    3. logcat Monitor -
    4. - -
    5. Memory Monitor -
    6. - -
    7. CPU Monitor -
    8. - -
    9. - Network Monitor -
    10. -
    - -

    - Dependencies and Prerequisites -

    - - -
    @@ -96,33 +48,34 @@ page.tags=monitor

    - Follow these steps: + To display an app running on a particular device or emulator in the GPU Monitor:

      -
    1. Optionally connect a hardware device. +
    2. Meet the prerequisites and dependencies.
    3. - -
    4. - Display Android Monitor. +
    5. Open an app project.
    6. - -
    7. Click the GPU tab. -
    8. - -
    9. Open an app project and run it on a hardware device or +
    10. Run the app on a hardware device or emulator.
    11. +
    12. + Display Android Monitor. +
    13. +
    14. Click the Monitors tab and display the GPU Monitor. +
    15. -
    16. Enable the GPU Monitor by clicking Pause Pause icon to deselect - it. +
    17. Enable the GPU Monitor by clicking Pause Pause icon to deselect it.
    18. Any GPU usage begins to appear in the GPU Monitor:

      - +

      The y-axis is the amount of time it takes the GPU to execute, process, prepare, and draw frames, diff --git a/docs/html/tools/help/am-hprof.jd b/docs/html/tools/help/am-hprof.jd new file mode 100644 index 0000000000000..1eef6ab76c91f --- /dev/null +++ b/docs/html/tools/help/am-hprof.jd @@ -0,0 +1,355 @@ +page.title=HPROF Viewer and Analyzer +parent.title=Android Monitor +parent.link=android-monitor.html +meta.tags="android, performance, profiling, tools, monitor" +page.tags="android", "performance", "profiling", "tools", "monitor" +page.metaDescription=Use the Memory Monitor to dump the Java heap to an HPROF file. The HPROF Viewer displays classes, instances of each class, and a reference tree to help you track memory usage and find memory leaks. +page.image=tools/help/thumbnails/am_hprofviewer.png +page.article=true + +@jd:body + +

      + +
      + + +

      + When you're monitoring memory usage in the Memory Monitor you can, at the same time, dump a + snapshot of the Java heap to an Android-specific Heap/CPU Profiling (HPROF) file. The HPROF Viewer + displays classes, instances of each class, and a reference tree to help you track memory usage + and find memory leaks. HPROF is a binary heap dump format originally supported by J2SE. +

      +

      + Why Look at the Java Heap? +

      +

      The Java heap display does the following:

      + + + +

      + However, you have to look for changes over time yourself by tracking what's happening in the + graph. +

      + +

      + The HPROF Analyzer finds the following potential issues: +

      + + + +

      + A dominator is at the top of a tree. If you remove it, you also remove the branches of the tree + it dominates, so it’s a potential way to free memory. +

      + +

      + Understanding the HPROF Viewer Display +

      + +

      + The HPROF Viewer looks similar to the following figure: +

      + +

      + The tool displays the following information: +

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      ColumnDescription
      Class NameThe Java class responsible for the memory.
      Total CountTotal number of instances outstanding.
      Heap CountNumber of instances in the selected heap.
      SizeofSize of the instances (currently, 0 if the size is variable).
      Shallow SizeTotal size of all instances in this heap.
      Retained SizeSize of memory that all instances of this class is dominating.
      InstanceA specific instance of the class.
      Reference TreeReferences that point to the selected instance, as well as references pointing to the + references.
      DepthThe shortest number of hops from any GC root to the selected instance.
      Shallow SizeSize of this instance.
      Dominating SizeSize of memory that this instance is dominating.
      + +

      If you click Capture Analysis, the HPROF Analyzer appears:

      + +

      You can detect leaked activities and find duplicate strings with the HPROF Analyzer.

      + +

      + Taking and Displaying a Snapshot of the Java Heap +

      + +

      + To examine a snapshot of the Java heap: +

      + +
        +
      1. Display a running app in the Memory + Monitor.
      2. +
      3. Click Dump Java Heap + Dump Java Heap icon. +
      4. + + +

        + When the icon on the Memory Monitor display changes from + Dump Java Heap Start icon to + Dump Java Heap End icon, the file is ready. Android Studio creates the heap snapshot + file with the + filename package_yyyy.mm.dd_hh.mm.ss.hprof using + the activity package (or project) name, year, month, day, hour, minute, and second of the + capture, for example, + com.android.calc_2015.11.17_14.58.48.hprof. +

        +

        + The HPROF Viewer appears. +

        +
      + +

      Viewing a Saved HPROF File

      +

      After you do a heap dump, Android Studio automatically stores it so you can view it again. +

      +

      To view an HPROF file in the HPROF Viewer:

      + +
        +
      1. Click +Captures icon in the main window.
      2. +

        Or select View > Tools Windows > +Captures.

        +

        The Captures window appears.

        +
      3. Open the Heap Snapshot folder.
      4. + + +
      5. Double-click the file to view it in the HPROF Viewer. +
      6. +

        + The HPROF Viewer appears. +

        + + +
      7. Select the Heap menu option you want to display: +
          +
        • + App heap - The heap used by the current app. +
        • + +
        • Image heap - The memory mapped copy of the + current app on disk. +
        • + + +
        • + Zygote heap - The common set of libraries and runtime classes and data that + all apps are forked + from. The zygote space is created during device startup and is never allocated into. +
        • + +
        + +
      8. Select the View menu option you want to display: +
          +
        • + Class List View +
        • + +
        • + Package Tree View +
        • +
        +
      + + +

      + Diving into Heap Dump Data in the HPROF Viewer +

      +

      The following steps outline the typical workflow:

      +
        +
      1. In the HPROF Viewer, select a class name.
      2. +
      3. Select an instance of that class.
      4. +
      5. Examine the reference tree.
      6. +
      7. Right-click an item to Jump to source or Go to instance, + as needed.
      8. +
      + + + +

      Analyzing Heap Dump Data in the HPROF Analyzer

      +

      You can detect leaked activities and find duplicate strings with the HPROF Analyzer. +

      +

      To use the HPROF Analyzer:

      +
        +
      1. In the Captures window, double-click an .hprof file to display it in the + HPROF Viewer.
      2. +
      3. Click Capture Analysis on the right side of the main Android Studio window.
      4. + + +

        The HPROF Analyzer appears to the right of the HPROF Analyzer, by default.

        + + + +
      5. In the Analyzer Tasks list, select the items you want to find.
      6. +
      7. Click Perform Analysis Perform Analysis icon.
      8. +
      9. Examine the items in Analysis Results. Click an item to display it in the + HPROF Viewer.
      10. +
      + + + +

      Sorting Heap Dump Data

      +

      To sort heap dump data:

      + + + +

      Displaying Java Source

      +

      For some items displayed in the HPROF Viewer, you can go straight to its +source code. +

      +

      To display Java source:

      + + +

      Working with HPROF Files

      +

      You can rename, locate, and delete an HPROF file from within Android Studio. +You can also convert it to standard HPROF format to use with other analysis +tools.

      + +

      Renaming an HPROF file

      + +

      If you rename a file from within Android Studio, it continues to appear in +the Captures window.

      +

      To rename an HPROF file:

      +
        +
      1. In the Captures window, right-click the file and select Rename.
      2. +
      3. In the dialog, specify the name of the file and click OK.
      4. +
      + + +

      Locating a heap dump file on disk

      +

      You can quickly discover where Android Studio stored HPROF files on disk.

      + + +

      To locate an HPROF file on disk:

      + +

      Note: If you move an HPROF file, Android Studio no longer + displays it in the Captures window. To display it, use + File > Open. Also, if you want to rename the file, do it + from the Captures window and not in the operating system file browser.

      + +

      Deleting a heap dump file

      + +

      To delete a heap dump file:

      + + +

      Converting a heap dump file to standard HPROF format

      +

      You can convert an HPROF file to standard format so you can use it outside of Android Studio with + other analysis tools.

      +

      To convert an HPROF file:

      +
        +
      1. In the Captures window, right-click a heap snapshot file and select Export to + standard .hprof.
      2. +
      3. In the Convert Android Java Heap Dump dialog, specify a filename and click + OK.
      4. + + +

        Android Studio creates a binary HPROF file in the location you specified.

        +
      diff --git a/docs/html/tools/help/am-logcat.jd b/docs/html/tools/help/am-logcat.jd index 57da848ae1d7a..9e26bca6053b1 100644 --- a/docs/html/tools/help/am-logcat.jd +++ b/docs/html/tools/help/am-logcat.jd @@ -1,7 +1,12 @@ page.title=logcat Monitor parent.title=Android Monitor parent.link=android-monitor.html -page.tags=monitor +meta.tags="android, performance, profiling, tools, monitor" +page.tags="android", "performance", "profiling", "tools", "monitor" +page.metaDescription=Use the logcat Monitor to view system and user-defined log messages. You can filter the messages to display just the items that interest you. +page.image=tools/help/thumbnails/am-logcatmon2.png +page.article=true + @jd:body

    @@ -63,58 +65,31 @@ page.tags=monitor
  • Reading and Writing Logs
  • -
  • - Android Monitor -
  • - -
  • Memory Monitor -
  • - -
  • CPU Monitor -
  • - -
  • GPU Monitor -
  • - -
  • - Network Monitor -
  • -

    - Dependencies and Prerequisites -

    - -

    The Android logging system provides a mechanism for collecting and viewing system debug output. - logcat Monitor displays messages that you added to your app by using the Log class, as well as system - messages, such as stack traces when the emulator throws an error or a garbage collection occurs. - The monitor displays messages in real time and also keeps a history so you can view older + The logcat Monitor displays system messages, such as when a garbage collection occurs, as well as + messages that you added to your app by using the Log class. + It displays messages in real time and also keeps a history so you can view older messages.

    To display just the information of interest, you can create filters, modify how much information is displayed in messages, set priority levels, display messages produced by app code - only, and search the log. By default, logcat Monitor shows the log output related to the running - application only. + only, and search the log. By default, the logcat Monitor shows the log output related to the + most recently run app only.

    - You can traverse the stack trace when your app throws an exception, as well as view the - associated code. This feature can help you fix exceptions and improve app operation. + When an app throws an exception, the logcat Monitor shows a message followed by the associated + stack trace containing links to + the code. This feature can help you fix errors and improve app operation.

    @@ -125,9 +100,9 @@ page.tags=monitor Every Android log message has a tag and a priority associated with it. The tag of a system log message is a short string indicating the system component from which the message originates (for example, - ActivityManager). A user-defined tag can be any string that you find helpful, such - as the name of the current class (the recommended tag). You define it in a Log - method call, for example: + {@link android.app.ActivityManager}). A user-defined tag can be any string that you find helpful, + such as the name of the current class (the recommended tag). You define it in a + {@link android.util.Log} method call, for example:

    @@ -189,31 +164,38 @@ Log.d(tag, message);
     

    - Follow these steps: + To display the log messages for a particular app:

      -
    1. Optionally connect a hardware device. +
    2. Meet the prerequisites and dependencies. +
    3. +
    4. Open an app project. +
    5. +
    6. Run the app on a hardware device or + emulator.
    7. -
    8. - Display Android Monitor. + Display Android Monitor.
    9. Click the logcat tab.
    10. -
    11. Open an app project and run it on a hardware device or - emulator. -
    12. +

      - By default, the logcat Monitor displays messages for the app running on the device or emulator: + By default, the logcat Monitor displays just the log messages for your app running on the + device or emulator:

      - +

      To change this default, see Filtering logcat Messages.

      +
    13. Optionally select a different device, emulator, or process. +

    @@ -221,17 +203,17 @@ Log.d(tag, message);

    - You can control how many messages appear in logcat Monitor by setting the log level. You can + You can control how many messages appear in the logcat Monitor by setting the log level. You can display all messages, or just the messages indicating the most severe conditions.

    - Remember that logcat Monitor continues to collect all messages regardless of the log level setting. - The setting just determines what logcat Monitor displays. + Remember that the logcat Monitor continues to collect all messages regardless of the log level setting. + The setting just determines what the logcat Monitor displays.

    - Follow this step: + To set the log level:

  • - Click + to add it to the left pane. + Click + to add the filter definition to the left pane.
  • @@ -398,6 +383,14 @@ Log.d(tag, message); Cancel, any filter additions or modifications are lost. +

  • + Make sure you see the log messages you want to examine. +
  • +

    + If you don't think you see the log messages you want, try selecting + No filters and searching for particular + log messages. +

    @@ -405,7 +398,7 @@ Log.d(tag, message);

    - You can customize the header display to show just the information you’re interested + To customize the header display to show just the information you’re interested in:

    @@ -440,7 +433,9 @@ Log.d(tag, message); in the Code Editor. If needed (and possible), the decompiler derives source code that you can view.

    - +

    + To move up and down the stack trace, and view the associated code in the Code Editor: +