android 性能分析之常用adb命令adb shell am start -W
来源:互联网 发布:淘宝优惠券怎么用不了 编辑:程序博客网 时间:2024/05/29 16:13
查看页面启动时间:
以启动camera为例
adb shell am start -W com.mediatek.camera/com.android.camera.CameraActivity
ubuntu@ubuntu:/media/disk/work/core$ adb shell am start -W com.mediatek.camera/com.android.camera.CameraActivity Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mediatek.camera/com.android.camera.CameraActivity } Status: ok Activity: com.mediatek.camera/com.android.camera.CameraActivity ThisTime: 2871 TotalTime: 2871 WaitTime: 2949Complete
格式为adb shell am start -W 包名/全类名或叫activity名
打印的结果为
ThisTime 该activity启动耗时
TotalTime 应用自身启动耗时=ThisTime+应用application等资源启动时间
WaitTime 系统启动应用耗时=TotalTime+系统资源启动时间
在测试该启动时间时需要理解两个概念
冷启动:应用第一次启动
热启动:按back按键后再启动或非第一次启动切没有清除该应用后台或缓存数据
上面的数据为冷启动打印的数据,下面运行热启动的测试结果:
ubuntu@ubuntu:/media/disk/work/core$ adb shell am start -W com.mediatek.camera/com.android.camera.CameraActivityStarting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mediatek.camera/com.android.camera.CameraActivity }Status: okActivity: com.mediatek.camera/com.android.camera.CameraActivityThisTime: 1848TotalTime: 1848WaitTime: 1895Complete
该命令具体实现在/frameworks/base/cmds/am/src/com/android/commands/am/Am.java,原理是跨Binder调用ActivityManagerService.startActivityAndWait() 接口,其中返回数据分别调用对应
startTime: 调用startActivityAndWait()的时间点
endTime: 调用startActivityAndWait()函数调用返回的时间点
WaitTime: 调用startActivityAndWait()调用耗时。
再通过之间的计算得到。
阅读全文
0 0
- android 性能分析之常用adb命令adb shell am start -W
- adb shell am start 命令
- adb shell am start -W卡住
- adb shell am start -W PackageName/ClassName
- android单元测试adb shell am instrument -w
- 使用 adb shell am start-W 命令查看应用启动时间的注意事项
- adb启动程序命令:adb shell am start
- adb启动程序命令:adb shell am start
- adb shell am命令
- adb shell am 命令
- adb shell am命令
- adb shell命令整理之am
- Android adb shell am 命令介绍
- Android 通过adb shell am broadcast发送广播 adb命令
- android adb am命令
- android adb am命令
- android adb am命令
- android 常用adb 和 adb shell 命令
- 字节流与字符流的区别详解
- springboot整合dubbo
- iOS 图片擦除
- 深入理解Java中类加载的流程和机制
- Core Location定位
- android 性能分析之常用adb命令adb shell am start -W
- Swift
- [JavaWeb]jsp图片ajax异步上传,利用ajaxfileupload
- Java基础集合Map
- C语言变长数组data[0]【总结】
- 网络运维实现方案
- leetcode 110. Balanced Binary Tree DFS
- 如何使用jquery 动态修改元素的 background-image?
- Ubuntu 8.04安装VMware tools