The Systrace of Android performance optimization tool

Source: Internet
Author: User
Tags set time python script

Most of this article is from:http://www.androidperformance.com/android-performance-tools-systrace-1.html?utm_source=tuicool

Systrace is the new performance data sampling and analysis tool in Android4.1. It helps developers to gather operational information from key Android subsystems (such as Surfaceflinger, Windowmanagerservice, and other framework-critical modules, services, view systems, etc.) to help developers more intuitively analyze system bottlenecks. Improve performance.

The Systrace features include tracking system I/O operations, kernel work queues, CPU load, and the health of various Android subsystems. In the Android platform, it consists mainly of 3 parts:

    • Kernel part: Systrace leverages the Ftrace functionality in Linux kernel. Therefore, if you want to use Systrace, you must turn on kernel and ftrace related modules.
    • Data Acquisition Section: Android defines a Trace class. The application can use this class to output statistics to ftrace. At the same time, Android also has a atrace program, which can read statistics from the ftrace and then hand it to the data analysis tool to handle.
    • Data Analysis Tool: Android provides a systrace.py (Python script file, located in the Android SDK directory/tools/systrace, which internally calls the Atrace program) to configure how data is collected, such as the label Output file name, etc.) and collect ftrace statistics and generate a result page file for users to view. Essentially, Systrace is the encapsulation of ftrace in Linux kernel. The application process needs to use the Trace class provided by Android to Systrace.

The official introduction and use of Systrace can be seen here: systrace

1.Systrace Simple to use

Before using Systrace, you should first understand the use of systrace on each platform, given the majority of people using Eclipse and Android studio, so directly excerpt from the official website about this method of use, but no matter what tool, the process is the same:

    • Your phone is ready for the interface you want to crawl
    • Click to start crawling (command line is to start executing commands)
    • Start operation on the phone
    • After the set time is up, the trace file will be generated and the file will be opened for analysis using Chrome.
Using Eclipse
    1. In Eclipse, open an Android application project.
      1. Switch to the DDMS perspective, by selecting Window > Perspectives > DDMS.
      2. In the Devices tab, select the device on which to run a trace. If no devices was listed, make sure your device was connected via USB cable and that debugging was enabled on the device.
      3. Click the Systrace icon at the top of the Devices panel to configure tracing.
      4. Set The tracing options and click OK to start the trace.
Using Android Studio
    1. In Android Studio, open an Android application project.
      1. Open the Device Monitor by selecting Tools > Android > Monitor.
      2. In the Devices tab, select the device on which to run a trace. If no devices was listed, make sure your device was connected via USB cable and that debugging was enabled on the device.
      3. Click the Systrace icon at the top of the Devices panel to configure tracing.
      4. Set The tracing options and click OK to start the trace.
Using Device Monitor
    1. Navigate to your SDK tools/directory.
      1. Run the monitor program.
      2. In the Devices tab, select the device on which to run a trace. If no devices was listed, make sure your device was connected via USB cable and that debugging was enabled on the device.
      3. Click the Systrace icon at the top of the Devices panel to configure tracing.
      4. Set The tracing options and click OK to start the trace.

Graphic:

First go to Ddms, then click on the device, click the Systrace button, then select the test item, here you can set the time. Click OK to start operating your phone, and the report will be generated automatically when the time is up.

Reference from:

http://blog.csdn.net/tommy_wxie/article/details/8636853

Http://www.androidperformance.com/android-performance-tools-systrace-1.html?utm_source=tuicool

The Systrace of Android performance optimization tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.