Systrace Walkthrough

Systrace Walkthrough

In this document

  • Prerequisites
  • Working with Systrace

You should also read

  • Traceview Walkthrough
  • Allocation Tracker Walkthrough

This walkthrough shows the basic usage and workflow for the Systrace tool in the Android Device Monitor.

Systrace collects system and application process execution data and generates detailed, interactive reports from devices running Android 4.1 and higher.

What it's good for:

  • Evaluating container performance.
  • Finding performance bottlenecks in the execution of your code.

Prerequisites

  • Android SDK Tools 20.
  • Python installed and included in your development computer's execution path.
  • A mobile device running at least Android 4.1 with Developer Options and USB Debugging enabled in Developer Options.
  • Application code. Use your own code, or the Sunshine sample app from the Android Fundamentals Udacity course.

Working with Systrace

    1. Figure 1. Starting Android Device Monitor.

    2. Connect your mobile device to your computer.
    3. Open your application in Android Studio, build the source, and run it on your device.
    4. From Android Studio, start the Android Device Monitor: Tools -> Android -> Android DeviceMonitor.
    1. Figure 2. Steps for starting Systrace.

    2. Make sure your device and the package for your application are showing in the Devices (DDMS mode) or Windows (Hierarchy Viewer mode) tab.

      You can choose Window > Reset Perspective to get back to the default arrangement.

    3. Click the DDMS button, because Systrace is one of the DDMS tools.
    4. Click the Systrace button .
    1. Figure 3. Steps for creating a trace.

    2. In the Android System Trace popup, choose your settings for the trace.
      • Destination File: Where the trace is stored as an HTML file. Default is in your home directory astrace.html.
      • Trace Duration: Default is 5 seconds, and 30 seconds is a good time to choose.
      • Trace Buffer size: Default is unlimited.
      • Enable Application Traces from: Make sure your app is selected.
      • Select tags to enable: Choose at least one value to trace, for example Graphics and View System.
    3. Click OK to start tracing.
    4. Interact with your app.
    1. Figure 4. Example systrace output in browser.

    2. When the trace is done, you are automatically returned to Android Device Monitor.
    3. Go to your home directory, or the directory you chose as the file destination.
    4. Open the trace.html file in your browser.

你可能感兴趣的:(Systrace Walkthrough)