Android 优化Android知识Android开发

google 官方教程学习之UI性能优化( Analyzing

2017-04-14  本文已影响222人  Angels_安杰

更多分享请看http://www.cherylgood.cn

Overview


![Uploading System Trace_138631.png . . .]](http:https://img.haomeiwen.com/i1811893/60c7a5586a4decba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)



Generating a Trace 生成追踪报告



Tracing on Android 4.3 and higher


1、在build.gradle文件中设置
android {
buildTypes {
debug {
debuggable true
}
2、在AndroidManifest.xml中在<application>节点增加
android:debuggable="true"
注意:在应用发布时需一处调试配置。


Analyzing a Trace 分析追踪的数据


Inspecting Frames 分析画面

System Trace.png

Investigating Alerts

图3.png System Trace.png

Tracing Application Code


Note: When you nest trace calls within each other, the endSection() method ends the most recently called beginSection(String) method. This means that a trace started within another trace cannot extend beyond the end of the enclosing trace, so make sure your beginning and ending method calls are properly matched to measure your applications processing.
注意:当你在彼此之间嵌套跟踪调用时,endSection()方法将结束最近称为beginSection(String)的方法。 这意味着在另一个跟踪中启动的跟踪不能超出封闭跟踪的结尾,因此请确保你的开始和结束方法调用已正确匹配,以测量应用程序处理。

Note: Traces must begin and end on the same thread. Do not call beginSection(String)on one thread of execution and then attempt to end the trace with a call to endSection()on another thread.
跟踪必须在同一个线程上开始和结束。 不要在一个执行线程上调用beginSection(String),然后尝试在另一个线程上调用endSection()来结束跟踪。

上一篇 下一篇

猜你喜欢

热点阅读