In this document
You should also read
This walkthrough shows the basic usage and workflow for the Traceview tool. Traceview logs
method execution over time and shows execution data, per-thread timelines, and call stacks.
What it's good for:
- Tracking down performance problems in your source code.
Prerequisites
Working with Traceview
- Connect your mobile device to your computer.
- Open your application in Android Studio, build the source, and run it on your device.
- Start the Android Device Monitor from Android Studio: Tools -> Android -> Android
Device Monitor.
- Make sure your device
and the package for your application are showing in the Devices (DDMS mode) or
Windows (Hierarchy Viewer mode) tab.
If necessary choose Window > Reset
Perspective to get back to the default pane arrangement.
- Click the DDMS button, because Traceview is one of the DDMS tools.
- Select the app you want to profile.
- Click the Start method profiling
button.
- In the Profiling Options popup:
- Choose Sample based profiling
- Keep the default sampling rate of 1000 microseconds.
- Click OK.
- Interact with your application. If you are aware of performance issues that
your users experience, perform those actions.
- Click the Stop method profiling
button.
- Wait for the trace to load. This may take a few seconds if you recorded for a
long time.
- Traceview has two panels: Timeline pane and Profile pane, which
are described below.
- Use the Find box at the bottom to filter your profile results. For
example, if you are interested in finding the running time for a function, you can
search for it, and the tool will highlight it in the timeline.
- The Timeline pane visualizes how your code executes over time.
- Each row shows a thread.
- Each bar on the timeline is a method executing.
- Each color is for a different method; every time a method executes, you see
a the same color bar.
- The width of its bar indicates how long the method takes to execute.
- When you are zoomed out, a bar indicates when a method is executing.
- Zoom into the graph, and the bar for each method expands into a colored
U-shape, where the left side of the U indicates the start, and the right side
the end of the method's execution.
- The Profiling pane shows a list of methods.
- Select a method to see who called it (Parent) and who it's
calling (Children).
- The selected method is also highlighted in the Timeline pane.
- The columns show exclusive and inclusive CPU and real times, percentages,
ratios, and how often a method was called.
- The exclusive time is the time spent just in the method itself, which can
help you find issues within that specific method.
- The inclusive time is for the method and all methods it calls, which
can help you find problems with your call tree.
- The Calls+Rec column shows how many times a method was called recursively,
which can help you track down performance issues.
This site uses cookies to store your preferences for site-specific language and display options.
This doc is hidden because your selected API level for the
documentation is . You can change the
documentation API level with the selector above the left navigation.
For more information about specifying the API level your app requires,
read Supporting
Different Platform Versions.