Android性能优化工具之Systrace

时间:2015-01-31 23:03:49   收藏:0   阅读:372

  本文大部分内容来自:http://www.androidperformance.com/android-performance-tools-systrace-1.html?utm_source=tuicool

  Systrace是Android4.1中新增的性能数据采样和分析工具。它可帮助开发者收集Android关键子系统(如surfaceflinger、WindowManagerService等Framework部分关键模块、服务,View系统等)的运行信息,从而帮助开发者更直观的分析系统瓶颈,改进性能。

Systrace的功能包括跟踪系统的I/O操作、内核工作队列、CPU负载以及Android各个子系统的运行状况等。在Android平台中,它主要由3部分组成:

关于Systrace的官方介绍和使用可以看这里:Systrace

1.Systrace简单使用

使用Systrace前,要先了解一下Systrace在各个平台上的使用方法,鉴于大家使用Eclipse和Android Studio的居多,所以直接摘抄官网关于这个的使用方法,不过不管是什么工具,流程是一样的:

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 are listed, make sure your device is connected via USB cable and that debugging is 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 are listed, make sure your device is connected via USB cable and that debugging is 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 are listed, make sure your device is connected via USB cable and that debugging is 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.

 

图解:

首先进入DDMS,然后点击设备,点击Systrace按钮,接着选择测试项,这里可以设定时间。点击确定后开始操作手机,在时间到了后会自动生成报表。

技术分享

 

技术分享

技术分享

 

参考自:

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

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

原文:http://www.cnblogs.com/tianzhijiexian/p/4264794.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!