创建你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 中看到生成的文件

image

选择

image

把我们要的trace文件拿出来

image

这里注意,文件路径要大全,不然,无法显示…

时间片面板(Timeline panel)

image

分析面板(Profile panel)

image

以下是翻译

英语 中文
Incl 调用方法占用时间百分比
Inclusive 调用方法时间(ms)(包括了所有方法的调用)
Excl 执行方法占用时间百分比
Exclusive 执行方法占用时间(ms)(不包括子方法的调用)
Calls+Recur Calls/Total 调用和重复调用的次数
Time/Call 总的时间(ms)

文档中提及一个dmtracdedump 的工具 要预装Graphviz ,而且,还要写pytho脚本才能用…

image

效果就是这样,有兴趣的可以参考:

http://blog.csdn.net/zjujoe/article/details/6080738

更多相关文章

  1. [转]]Android 应用签名提权方法
  2. 【Android】android开发---实现屏幕旋转的两种方法
  3. Android-缓存数据保存-通用方法
  4. Android 中 ListView Adapter getView 被多次调用问题 解决方法
  5. Android监听来电和去电的实现方法
  6. Android 屏幕的旋转 onConfigurationChanged方法
  7. 查看android里的数据库的内容的方法
  8. 让android定时关机的实现方法
  9. android Listview中button 和Listview可同时点击的方法

随机推荐

  1. Android(安卓)手势操作GestureDetector
  2. Android中Bitmap内存占用分析
  3. Android操作数据连接和Wifi
  4. Android多线程系列(一) AsyncTask基本使用
  5. 四通道手机和Android的信用卡替代
  6. Android(安卓)基础知识之 VelocityTracke
  7. Android之使用SoundPool播放一小段音频,实
  8. Android(安卓)XML解析Pull方式———解析
  9. Android一种实现夜间模式方式,同时解决调
  10. Android基于IIS的APK下载(一)自定义更新