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 + +
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.
+ ++ The Allocation Tracker looks similar to the following figure: +
++ + +
The tool displays the following information:
+ +| Column | +Description | +
|---|---|
| Method | +The Java method responsible for the allocation. | +
| Count | +Total number of instances allocated. | +
| Size | +The total amount of allocated memory in bytes. | +
To examine allocation data:
+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.
to display a visual representation of the data.
+ 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:
+ + +
in the main window.Or select View > Tools Windows > +Captures.
+The Captures window appears.
+To sort allocation data:
+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.
+ + +You can rename, locate, and delete an allocation tracking file from within +Android Studio.
+ +If you rename a file from within Android Studio, it continues to appear in the Captures + window.
+To rename 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:
+Android Studio opens an operating system file browser displaying the location where the file + resides.
+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.
+ +To delete an allocation tracking file:
+Android Studio deletes the file from the Captures dialog and from disk.
+
+ 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.
+
+ 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: +
+debuggable property to true in the manifest or
+ build.gradle file (it’s initially set by default).
+ + 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. +
+ + + ++ 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: +
+
+
++ After you've met the prerequisites and optionally connected a hardware device, you're ready + to profile an app in Android Monitor: +
+ ++ 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: +
+ ++ 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: +
+ ++ 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. +
++ You can rearrange the Android Monitor windows for optimal viewing during your + tests: +
+
or Move Monitor Down
+
.
+
+ or Maximize Monitor
+
.
+ + To rearrange the logcat and Monitors tabs: +
+
> Floating Mode.
+
icon. To make it reappear, click Restore Monitors View
+
+ or the Restore logcat View
+
+ on the far right of the row of tabs.
+ + To stop an app you’ve run from Android Studio: +
+ +
.
+ + 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. +
++ 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. +
+ ++ From the Android Monitor main window, you can also do the following: +
+ +dumpsys system information.
+ debuggable property to true in the manifest or
- build.gradle file (it’s initially set by default).
- 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.
+- Follow these steps: + To display an app running on a particular device or emulator in the CPU Monitor:
to deselect
- it.
+ style="vertical-align:sub;margin:0;height:17px" alt="Pause icon" /> to deselect it.
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.
-
+
again to select
it.
- Follow these steps: -
- -
to
- select it.
-
to
- deselect it.
- - The method trace appears in the Code Editor area: -
-
-
- 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.
-
- The display shows the following information: -
-| Field | -Description | -
|---|---|
| Name | -The name of the method. | -
| Invocation Count | -How 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. -
-- After you do a method trace, Android Studio automatically stores it so you can view it - again. To examine the trace, follow these steps: -
- -- The Captures window appears. -
- -- You can sort the data by method name, count, inclusive time, and exclusive time. Follow this step: -
- - -- Rename a method trace file from within Android Studio so it - continues to appear in the Captures window. Follow these steps: -
- -- 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.
-- Android Studio opens an operating system file browser displaying the location where the file - resides. -
-- 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. -
- -- 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:bodydebuggable property to true in the manifest or
- build.gradle file (it’s initially set by default).
- - Follow these steps: + To display an app running on a particular device or emulator in the GPU Monitor:
to deselect
- it.
+
to deselect it.
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. +
+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. +
+ ++ The HPROF Viewer looks similar to the following figure: +
+
++ The tool displays the following information: +
+ +| Column | +Description | +
|---|---|
| Class Name | +The Java class responsible for the memory. | +
| Total Count | +Total number of instances outstanding. | +
| Heap Count | +Number of instances in the selected heap. | +
| Sizeof | +Size of the instances (currently, 0 if the size is variable). | +
| Shallow Size | +Total size of all instances in this heap. | +
| Retained Size | +Size of memory that all instances of this class is dominating. | +
| Instance | +A specific instance of the class. | +
| Reference Tree | +References that point to the selected instance, as well as references pointing to the + references. | +
| Depth | +The shortest number of hops from any GC root to the selected instance. | +
| Shallow Size | +Size of this instance. | +
| Dominating Size | +Size 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.
+ ++ To examine a snapshot of the Java heap: +
+ +
.
+
+ When the icon on the Memory Monitor display changes from
+
to
+
, 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. +
+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:
+ +
in the main window.Or select View > Tools Windows > +Captures.
+The Captures window appears.
++ The HPROF Viewer appears. +
+ + +The following steps outline the typical workflow:
+You can detect leaked activities and find duplicate strings with the HPROF Analyzer. +
+To use the HPROF Analyzer:
+.hprof file to display it in the
+ HPROF Viewer. The HPROF Analyzer appears to the right of the HPROF Analyzer, by default.
+ + + +
.To sort heap dump data:
+For some items displayed in the HPROF Viewer, you can go straight to its +source code. +
+To display Java source:
+The source code appears in the Code Editor.
+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.
+ +If you rename a file from within Android Studio, it continues to appear in +the Captures window.
+To rename an HPROF file:
+You can quickly discover where Android Studio stored HPROF files on disk.
+ + +To locate an HPROF file on disk:
+Android Studio opens an operating system file browser displaying the location where the file + resides.
+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.
+ +To delete a heap dump file:
+Android Studio deletes the file from the Captures dialog and from disk.
+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:
+Android Studio creates a binary HPROF file in the location you specified.
+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.
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:
- 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.
+- 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:
- You can search the messages currently displayed in logcat Monitor. Follow these steps: + To search the messages currently displayed in the logcat Monitor:
Note: The filter applies to your full logcat history, not just those messages - currently displayed in logcat Monitor. Make sure your other display options are set + currently displayed in the logcat Monitor. Make sure your other display options are set appropriately so you can see the filter output you want to examine.
- To define and apply a filter, follow these steps: + To define and apply a filter:
@@ -398,6 +383,14 @@ Log.d(tag, message); Cancel, any filter additions or modifications are lost.
+ If you don't think you see the log messages you want, try selecting + No filters and searching for particular + log messages. +
- 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: +
@@ -460,8 +455,11 @@ Log.d(tag, message);
- Clicking a particular message stops the display of messages. You can quickly move to - the end of the log to see the real-time message flow. + Clicking a particular message stops the display of messages. +
++ To quickly move to + the end of the log to see the real-time message flow:
- Follow these steps: + To preserve log information, you can send the log to a printer, write the log to a PDF file, or + copy and paste the log into a text file. +
++ To print the log or write it to a PDF file:
.
+ You can set the parameters to send the log to a printer or write it to a PDF file. +
++ To copy the log to a text file: +
+Press Ctrl+A (⌘A) to select all.
+- To clear (flush) the entire log, follow this step: + To clear (flush) the entire log:
-
-- If there is a problem and the log is no longer progressing, you can restart the log. Follow this - step: + If there's a problem and the log is no longer progressing, you can restart the log:
debuggable property to true in the manifest or
- build.gradle file (it’s initially set by default).
- One way to optimize memory usage is to analyze large arrays. For example, can you reduce the size - of individual elements in the array to save memory? Does a dominator object point to - an element in the array, preventing it from being garbage-collected? If the dominator object - directly points to an element in the array, the dominator is either the contiguous memory - representing the underlying data of the array, some part of the array, or the array itself. + of individual elements in the array to save memory?
@@ -347,25 +280,26 @@ page.tags=monitor
- Follow these steps: + To display an app running on a particular device or emulator in the Memory Monitor:
to deselect it.
@@ -389,10 +323,10 @@ page.tags=monitor
In the following figure, the VM initiated the first garbage collection event, while the developer forced the second.
-
+
- When you're monitoring memory usage in Android Studio you can, at the same time, dump the Java - heap to a heap snapshot in an Android-specific HPROF binary format 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 heap dump format originally supported by J2SE. -
-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: + You can take snapshots while the Memory Monitor is running or paused:
- 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. -
- -- To see a snapshot of the Java heap, follow these steps: -
- -
.
-
- When the icon on the Memory Monitor display changes from
-
to
-
, the file is ready. Android Studio creates the heap snapshot
- file with the
- filename Snapshot_yyyy.mm.dd_hh.mm.ss.hprof using
- the year, month, day, hour, minute, and second of the capture, for example,
- Snapshot_2015.11.17_14.58.48.hprof.
-
- The Captures window appears. -
- -- The HPROF Viewer appears: -
-
-- The tool displays the following information: -
- -| Column | -Description | -
|---|---|
| Class Name | -The Java class responsible for the memory. | -
| Total Count | -Total number of instances outstanding. | -
| Heap Count | -Number of instances in the selected heap. | -
| Sizeof | -Size of the instances (currently, 0 if the size is variable). | -
| Shallow Size | -Total size of all instances in this heap. | -
| Retained Size | -Size of memory that all instances of this class is dominating. | -
| Instance | -A specific instance of the class. | -
| Reference Tree | -References that point to the selected instance, as well as references pointing to the - references. | -
| Depth | -The shortest number of hops from any GC root to the selected instance. | -
| Shallow Size | -Size of this instance. | -
| Dominating Size | -Size of memory that this instance is dominating. | -
The following steps outline the typical workflow:
-You can detect leaked activities and find duplicate strings with the HPROF Analyzer. - Follow these steps:
-.hprof file to display it in the
- HPROF Viewer. The HPROF Analyzer appears to the right of the HPROF Analyzer, by default:
- -
-
-
.Follow this step:
-For some items displayed in the HPROF Viewer, you can go straight to its source code. - Follow this step:
-The source code appears in the Code Editor.
-After you do a heap dump, Android Studio automatically stores it so you can view it again. - Follow these steps:
- -The Captures window appears.
-If you rename a file from within Android Studio, it continues to appear in Captures - window. Follow these steps:
-You can quickly discover where Android Studio stored HPROF files on disk.
- - -Follow this step in Android Studio:
-Android Studio opens an operating system file browser displaying the location where the file - resides.
-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.
- -To delete a heap dump file, follow this step:
-Android Studio deletes the file from the Captures dialog and from disk.
-You can convert an HPROF file to standard format so you can use it outside of Android Studio with - other analysis tools. Follow these steps:
-Android Studio creates a binary HPROF file in the location you specified.
-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.
- -Follow these steps:
-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 Allocations_yyyy.mm.dd_hh.mm.ss.alloc using the year, month, day,
- hour, minute, and second of the capture, for example,
- Allocations_2015.11.17_14.58.48.alloc.
The Captures window appears.
-- The Allocation Tracker appears: -
-- - -
The tool displays the following information:
- -| Column | -Description | -
|---|---|
| Method | -The Java method responsible for the allocation. | -
| Count | -Total number of instances allocated. | -
| Size | -The total amount of allocated memory in bytes. | -
Follow this step:
-For some items displayed in the Allocation Tracker, you can view the Java source. Follow one of - these steps:
-
. The source code appears in the Code Editor.
- -After you monitor allocation tracking, Android Studio automatically stores it so you can view it - again. Follow these steps:
- - -The Captures window appears.
-If you rename a file from within Android Studio, it continues to appear in the Captures - window. Follow these steps:
-You can quickly discover where Android Studio stored allocation tracking files on disk.
- - -Follow this step in Android Studio:
-Android Studio opens an operating system file browser displaying the location where the file - resides.
-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.
- -Follow this step:
-Android Studio deletes the file from the Captures dialog and from disk.
-+ You can start a method trace from the CPU Monitor. It lets you view the call stack and timing + information for your app. This information can help you optimize and debug your app. +
+ ++ The method trace looks similar to the following figure: +
+
+
+
+The display shows the following information:
+ +| Field | +Description | +
|---|---|
| Name | +The name of the method. | +
| Invocation Count | +How 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.
+ ++ To perform a method trace: +
+ +
to
+ select it.
+
to
+ deselect it.
+ + The method trace appears in the Code Editor area. +
+ +
+ Android Studio creates the method trace file
+ with the filename package_yyyy.mm.dd_hh.mm.ss.trace
+ 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.trace.
+
+ 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. +
++ After you do a method trace, Android Studio automatically stores it so you can view it + again.
+ +To examine a saved method trace: +
+ +
in the main window.
+ Or select View > Tools Windows > + Captures.
+ ++ The Captures window appears. +
+ ++ You can sort the data by method name, count, inclusive time, and exclusive + time.
+ +To sort method trace data:
+ + +You can rename, locate, and delete a method trace file from within Android +Studio.
+ ++ Rename a method trace file from within Android Studio so it + continues to appear in the Captures window.
+ +To rename a method trace file: +
+ ++ You can quickly discover where Android Studio stored method trace files on + disk.
+ +To locate a method trace file on disk: +
+ + + ++ Android Studio opens an operating system file browser displaying the location where the file + resides. +
++ 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. +
+ ++ To delete a method trace file: +
+ ++ 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-network.jd b/docs/html/tools/help/am-network.jd index ae116ac4e58e9..812999207f7bb 100644 --- a/docs/html/tools/help/am-network.jd +++ b/docs/html/tools/help/am-network.jd @@ -1,7 +1,12 @@ page.title=Network 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 Network Monitor to analyze network requests, including how and when your app transfers data. Preserve battery life by optimizing network use. +page.image=tools/help/thumbnails/am-networkmon.png +page.article=true + @jd:bodydebuggable property to true in the manifest or
- build.gradle file (it’s initially set by default).
- - Follow these steps: + To display an app running on a particular device in the Network Monitor:
Connect a hardware device; the Network Monitor doesn't monitor an emulator. +
+
to deselect it.
to
- deselect it.
- Any network traffic begins to appear in the Network Monitor:
-
+
The Network Monitor adds up the amount of time it takes for the device to transmit and receive kilobytes of data. diff --git a/docs/html/tools/help/am-screenshot.jd b/docs/html/tools/help/am-screenshot.jd new file mode 100644 index 0000000000000..322616e23e248 --- /dev/null +++ b/docs/html/tools/help/am-screenshot.jd @@ -0,0 +1,89 @@ +page.title=Screen Capture +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 Screen Capture tool to take a screenshot of the display on a hardware device or the emulator. Optionally display the screenshot within a graphic of a device. +page.image=tools/help/thumbnails/am_screenshot.png +page.article=true +@jd:body + + +
+ You can take a PNG screenshot of the display on a connected device or the emulator. You can use + the images for your marketing materials as well as for debugging, for example. +
+ + ++ To take a screen capture: +
+
in the
+ Android Monitor toolbar.
+ The screenshot appears in a Screenshot Editor window.
+ +
+
+ The screenshot file appears in the Code Editor area.
+ + + + diff --git a/docs/html/tools/help/am-sysinfo.jd b/docs/html/tools/help/am-sysinfo.jd new file mode 100644 index 0000000000000..166cc082ee5b2 --- /dev/null +++ b/docs/html/tools/help/am-sysinfo.jd @@ -0,0 +1,205 @@ +page.title=System Information +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 System Information tool to capturedumpsys information about your app. View activity manager, package, memory usage, and graphics state information.
+page.image=tools/help/thumbnails/am_sysinfo.png
+page.article=true
+@jd:body
+
+ You can capture dumpsys output from within Android Monitor and
+ display the file in the Code Editor. The Captures window lists the
+ system information files so you can retrieve the information later for
+ analysis.
+
+ To capture and view a snapshot of system information: +
+ +
+ and then select a menu item.
+
+ The menu items display different types of dumpsys
+ output:
+
dumpsys activity
+ dumpsys package
+ dumpsys
+ meminfo
+ dumpsys
+ procstats
+ dumpsys gfxinfo
+ + The information appears in an editable text file in the Code Editor. +
+
+Android Studio creates the system information file with the
+ filename package_yyyy.mm.dd_hh.mm.ss.txt 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.txt.
+After you take a snapshot of system information, Android Studio automatically +stores it so you can view it again.
+ +To examine a saved system information file:
+ +
in the main window.
+ Or select View > Tools Windows > + Captures.
+ ++ The Captures window appears. +
+ +You can rename, locate, and delete a system information file from within +Android Studio.
+ ++ Rename a system information file from within Android Studio so it + continues to appear in the Captures window.
+ +To rename a system information file: +
+ ++ You can quickly discover where Android Studio stored system information files + on disk.
+ +To locate a system information file on disk: +
+ + + ++ Android Studio opens an operating system file browser displaying the location + where the file resides. +
++ Note: If you move a system information 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. +
+ ++ To delete a system information file: +
+ ++ Android Studio deletes the file from the Captures dialog and from + disk. +
diff --git a/docs/html/tools/help/am-video.jd b/docs/html/tools/help/am-video.jd new file mode 100644 index 0000000000000..5ecdd11ad40a6 --- /dev/null +++ b/docs/html/tools/help/am-video.jd @@ -0,0 +1,78 @@ +page.title=Video Capture +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 Video tool to make a video of the display on a hardware device. +page.image=tools/help/thumbnails/am_video.png +page.article=true +@jd:body + + ++ Android Studio lets you record an MP4 video from your hardware device for a maximum of three + minutes. You can use the video for your marketing materials as well as for debugging, for + example. +
+
+
+
+
++ To record a video from a hardware device: +
+
in the
+ Android Monitor toolbar.
+ The screenshot appears in a Screenshot Editor window.
+ +debuggable property to true in the manifest or
- build.gradle file (it’s initially set by default).
- Android Monitor helps you to profile the performance of your apps so you can optimize, debug, and improve them. It lets you monitor the following aspects of your apps from a hardware device or - the Android Studio emulator: + the Android Emulator:
- Android Monitor contains the logcat, Memory, CPU, GPU, and Network Monitors that you can use - separately to examine these aspects of your apps. -
+Android Monitor provides various tools that provide real-time information about your app. It + lets you capture data as your app runs and stores it in a file that you can analyze in various + viewers. You can also capture screen shots and videos of your app as it runs.
-- Android Monitor is integrated into the Android Studio main window: -
+View log messages — in real time and historically — which is useful for debugging.
-
-- Follow these steps: -
+Visualize the behavior and performance of your app.
-Android Monitor lets you capture various types of data about your app while it's running and + stores it in a file, which you can access whenever is convenient. + It lists these files in the Captures window.
-- 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 view 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, follow these steps: -
- -- 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: -
- -- 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. -
- -- You can take a PNG screenshot of the display on a connected device or the emulator. You can use - the images for your marketing materials as well as for debugging, for example. -
-- Follow these steps: -
-
in the
- Android Monitor toolbar.
- The screenshot appears in a Screenshot Editor window.
- -- Android Studio lets you record an MP4 video from your hardware device for a maximum of three - minutes. You can use the video for your marketing materials as well as for debugging, for - example. -
-- Follow these steps: -
-
in the Android Monitor toolbar.
- The screenshot appears in a Screenshot Editor window.
- -
- You can view dumpsys output from within Android Monitor. Follow these steps:
-
and then a
- menu item in the Android Monitor
- toolbar.
-
- The menu items display different types of dumpsys output:
-
dumpsys activity
- dumpsys package
- dumpsys
- meminfo
- dumpsys
- procstats
- dumpsys gfxinfo
- - The information appears in an editable text file in the Code Editor. -
-- If you want to stop an app you’ve run from Android Studio, follow these steps: -
- -
.
- - 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. -
-- You can rearrange the Android Monitor windows for optimal viewing during your tests: -
- -
> Floating Mode.
-
> Floating Mode to deselect it.
-
icon. To make it reappear, click the icon of
- the monitor on the far right of the row of tabs.
- - 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. -
+Create screen captures and videos of your app to help with marketing and debugging. +
+To begin using Android Monitor, start with Android Monitor Basics. +
diff --git a/docs/html/tools/help/thumbnails/am-androidmon2.png b/docs/html/tools/help/thumbnails/am-androidmon2.png new file mode 100644 index 0000000000000..a4a757193b09b Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-androidmon2.png differ diff --git a/docs/html/tools/help/thumbnails/am-cpumon.png b/docs/html/tools/help/thumbnails/am-cpumon.png new file mode 100644 index 0000000000000..59908c854db96 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-cpumon.png differ diff --git a/docs/html/tools/help/thumbnails/am-cpumon2.png b/docs/html/tools/help/thumbnails/am-cpumon2.png new file mode 100644 index 0000000000000..6ac6e0287a090 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-cpumon2.png differ diff --git a/docs/html/tools/help/thumbnails/am-gc2.png b/docs/html/tools/help/thumbnails/am-gc2.png new file mode 100644 index 0000000000000..a5e8b6e986d4f Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-gc2.png differ diff --git a/docs/html/tools/help/thumbnails/am-gpumon.png b/docs/html/tools/help/thumbnails/am-gpumon.png new file mode 100644 index 0000000000000..a414fe5e45fb8 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-gpumon.png differ diff --git a/docs/html/tools/help/thumbnails/am-gpumon2.png b/docs/html/tools/help/thumbnails/am-gpumon2.png new file mode 100644 index 0000000000000..5cf51d9320b29 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-gpumon2.png differ diff --git a/docs/html/tools/help/thumbnails/am-logcatmon2.png b/docs/html/tools/help/thumbnails/am-logcatmon2.png new file mode 100644 index 0000000000000..563593568f177 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-logcatmon2.png differ diff --git a/docs/html/tools/help/thumbnails/am-memorymon.png b/docs/html/tools/help/thumbnails/am-memorymon.png new file mode 100644 index 0000000000000..0fefb27cd5531 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-memorymon.png differ diff --git a/docs/html/tools/help/thumbnails/am-networkmon.png b/docs/html/tools/help/thumbnails/am-networkmon.png new file mode 100644 index 0000000000000..db9c647b7f0c9 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am-networkmon.png differ diff --git a/docs/html/tools/help/thumbnails/am_alloctracker.png b/docs/html/tools/help/thumbnails/am_alloctracker.png new file mode 100644 index 0000000000000..b94713d3cc284 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_alloctracker.png differ diff --git a/docs/html/tools/help/thumbnails/am_androidmon.png b/docs/html/tools/help/thumbnails/am_androidmon.png new file mode 100644 index 0000000000000..6b0523019b198 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_androidmon.png differ diff --git a/docs/html/tools/help/thumbnails/am_cpumon.png b/docs/html/tools/help/thumbnails/am_cpumon.png new file mode 100644 index 0000000000000..c8c0415535d18 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_cpumon.png differ diff --git a/docs/html/tools/help/thumbnails/am_gpumon.png b/docs/html/tools/help/thumbnails/am_gpumon.png new file mode 100644 index 0000000000000..e453e7de63c6c Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_gpumon.png differ diff --git a/docs/html/tools/help/thumbnails/am_hprofviewer.png b/docs/html/tools/help/thumbnails/am_hprofviewer.png new file mode 100644 index 0000000000000..342590fd41b2c Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_hprofviewer.png differ diff --git a/docs/html/tools/help/thumbnails/am_iscreencapture.png b/docs/html/tools/help/thumbnails/am_iscreencapture.png new file mode 100644 index 0000000000000..68135a711a743 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_iscreencapture.png differ diff --git a/docs/html/tools/help/thumbnails/am_isysteminfo.png b/docs/html/tools/help/thumbnails/am_isysteminfo.png new file mode 100644 index 0000000000000..37d77db9c036c Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_isysteminfo.png differ diff --git a/docs/html/tools/help/thumbnails/am_ivideo.png b/docs/html/tools/help/thumbnails/am_ivideo.png new file mode 100644 index 0000000000000..901eaf1400214 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_ivideo.png differ diff --git a/docs/html/tools/help/thumbnails/am_logcatmon.png b/docs/html/tools/help/thumbnails/am_logcatmon.png new file mode 100644 index 0000000000000..ca7063cb0ba05 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_logcatmon.png differ diff --git a/docs/html/tools/help/thumbnails/am_methodtrace.png b/docs/html/tools/help/thumbnails/am_methodtrace.png new file mode 100644 index 0000000000000..8d5ca4e6089ef Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_methodtrace.png differ diff --git a/docs/html/tools/help/thumbnails/am_networkmon2.png b/docs/html/tools/help/thumbnails/am_networkmon2.png new file mode 100644 index 0000000000000..f55f853e51afd Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_networkmon2.png differ diff --git a/docs/html/tools/help/thumbnails/am_screenshot.png b/docs/html/tools/help/thumbnails/am_screenshot.png new file mode 100644 index 0000000000000..66afff91facbd Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_screenshot.png differ diff --git a/docs/html/tools/help/thumbnails/am_sysinfo.png b/docs/html/tools/help/thumbnails/am_sysinfo.png new file mode 100644 index 0000000000000..9b5cd17207fb4 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_sysinfo.png differ diff --git a/docs/html/tools/help/thumbnails/am_video.png b/docs/html/tools/help/thumbnails/am_video.png new file mode 100644 index 0000000000000..209cb0c7d10d3 Binary files /dev/null and b/docs/html/tools/help/thumbnails/am_video.png differ diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs index c390523b24901..73d4ff3738c9e 100644 --- a/docs/html/tools/tools_toc.cs +++ b/docs/html/tools/tools_toc.cs @@ -147,6 +147,9 @@