android TraceView (图形化性能测试工具)使用入门笔记
16lz
2021-01-23
创建你TraceView
1.在开始使用TraceView你要注意:
你的设备和模拟器必须设置SD card 和 你的程序拥有对SD card 具有读写操作的权限(
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />)
2.在你的程序中使用TraceView
// 开始跟踪然后自动保存到 "/sdcard/test.trace" Debug.startMethodTracing("test"); // ... // 停止跟踪 Debug.stopMethodTracing();使用traceView就只需要这两个方法了…
举个例子我们可以在:
//onCreate方法中调用onCreate(){Debug.startMethodTracing("test");}//.............//onPause 方法中结束onPause{Debug.stopMethodTracing();}当然,你Debug的位置你可以随便设置,只要符合要求就行
然后,结束调试好,你会在eclipse 中的file explorer 中看到生成的文件
选择
把我们要的trace文件拿出来
这里注意,文件路径要大全,不然,无法显示…
时间片面板(Timeline panel)
分析面板(Profile panel)
以下是翻译
英语 中文 Incl 调用方法占用时间百分比 Inclusive 调用方法时间(ms)(包括了所有方法的调用) Excl 执行方法占用时间百分比 Exclusive 执行方法占用时间(ms)(不包括子方法的调用) Calls+Recur Calls/Total 调用和重复调用的次数 Time/Call 总的时间(ms) 文档中提及一个dmtracdedump 的工具 要预装Graphviz ,而且,还要写pytho脚本才能用…
效果就是这样,有兴趣的可以参考:
http://blog.csdn.net/zjujoe/article/details/6080738
更多相关文章
- [转]]Android 应用签名提权方法
- 【Android】android开发---实现屏幕旋转的两种方法
- Android-缓存数据保存-通用方法
- Android 中 ListView Adapter getView 被多次调用问题 解决方法
- Android监听来电和去电的实现方法
- Android 屏幕的旋转 onConfigurationChanged方法
- 查看android里的数据库的内容的方法
- 让android定时关机的实现方法
- android Listview中button 和Listview可同时点击的方法