The systrace command invokes the Systrace tool,
which allows you to collect and inspect timing information across all processes
running on your device at the system level.
This document explains how to generate Systrace reports from the command line. On devices running Android 9 (API level 28) or higher, you can also generate Systrace reports using the System Tracing system app.
In order to run systrace, complete the following steps:
- From Android Studio, download and install the latest Android SDK Tools.
- Install Python and include it in your
workstation's
PATHenvironment variable. - Add
android-sdk/platform-tools/to yourPATHenvironment variable. This directory contains the Android Debug Bridge binary (adb), which is called by thesystraceprogram. - Connect a device running Android 4.3 (API level 18) or higher to your development system using a USB debugging connection.
The systrace command is provided in the Android SDK Tools package and is
located in android-sdk/platform-tools/systrace/.
Syntax
To generate the HTML report for app, you need to run systrace from the
command line using the following syntax:
python systrace.py [options] [categories]
For example, the following command calls systrace to record device activity
and generate a HTML report named mynewtrace.html. This list of categories is a
reasonable default list for most devices.
$ python systrace.py -o mynewtrace.html sched freq idle am wm gfx view \
binder_driver hal dalvik camera input res memory
Tip: If you want to see the names of tasks in
the trace output, you must include the sched category in
your command parameters.
To view the list of categories that your connected device supports, run the following command:
$ python systrace.py --list-categories
If you don't specify any categories or options, systrace generates a report
that includes all available categories and uses default settings. The categories
available depend on the connected device you're using.
Global options
Commands and command options
Recommended for you
- Note: link text is displayed when JavaScript is off
- Capture a system trace on a device
