Reputation: 1
I want to measure the launch time (from application launch start to application first view render complete). Is there any adb command/combination of adb commands through which I can achieve this.
Upvotes: 0
Views: 4145
Reputation: 13
You can measure the launch time of application from adb logcat. You can check the prints of activity started & activity displayed from logcat, note the time difference between them to measure launch time.
adb logcat -vthreadtime | grep "start"
adb logcat -vthreadtime | grep "Displayed"
Or
You can use below command to launch application & find time from it's output : adb shell am start -W
Upvotes: 0
Reputation: 311
I'm not sure if what you want is possible through adb commands, but you can use the systrace tool included in the platform-tools/systrace folder of your Android SDK installation.
The Systrace tool can be run from the Android Developer Tools (ADT) in Eclipse, Android Studio, the Android Device Monitor or even in command line.
To run the Systrace user interface:
- In Eclipse, open an Android application project.
- Switch to the DDMS perspective, by selecting Window > Perspectives > DDMS.
- In the Devices tab, select the device on which to run a trace. If no devices are listed, make sure your device is connected via USB cable and that debugging is enabled on the device.
- Click the Systrace icon at the top of the Devices panel to configure tracing.
- Set the tracing options and click OK to start the trace.
- In Android Studio, open an Android application project.
- Open the Device Monitor by selecting Tools > Android > Monitor.
- In the Devices tab, select the device on which to run a trace. If no devices are listed, make sure your device is connected via USB cable and that debugging is enabled on the device.
- Click the Systrace icon at the top of the Devices panel to configure tracing.
- Set the tracing options and click OK to start the trace.
- Navigate to your SDK tools/ directory.
- Run the monitor program.
- In the Devices tab, select the device on which to run a trace. If no devices are listed, make sure your device is connected via USB cable and that debugging is enabled on the device.
- Click the Systrace icon at the top of the Devices panel to configure tracing.
- Set the tracing options and click OK to start the trace.
The Systrace tool has different command line options for devices running Android 4.3 (API level 18) and higher versus devices running Android 4.2 (API level 17) and lower. The following sections describe the different command line options for each version.
The general syntax for running Systrace from the command line is as follows.
$ python systrace.py [options] [category1] [category2] ... [categoryN]
Android 4.3 and higher options
When you use Systrace on devices running Android 4.3 and higher, you must specify at least one trace category tag. Here is an example execution run that sets trace tags and generates a trace from a connected device.
$ cd android-sdk/platform-tools/systrace
$ python systrace.py --time=10 -o mynewtrace.html sched gfx view wm
Tip: If you want to see the names of tasks in the trace output, you must include the sched category in your command parameters.
Android 4.2 and lower options
Using Systrace on the command line with devices running Android 4.2 and lower is typically a two-step process. You must first set the trace tags you want to capture and then run the trace. Here is an example execution run that sets trace tags and generates a trace from a connected device.
$ cd android-sdk/platform-tools/systrace
$ python systrace.py --set-tags gfx,view,wm
$ adb shell stop
$ adb shell start
$ python systrace.py --disk --time=10 -o mynewtrace.html
Upvotes: 3