Android 性能检测工具 TraceView 使用

78 阅读1分钟

使用方式

在代码开始打点和结束打点的地方分别执行 Debug 类 的startMethodTracing 和 stopMethodTracing

Debug.startMethodTracing("")

Debug.stopMethodTracing("")


启动应用后,会自动在 sdcard/Android/data/packagename/files 中生成 trace 文件

Trace 文件分析

特点

  • 运行时开销严重,整体都会变慢
  • 可能会带偏优化方向