课前准备
- ffmpeg安装 https://ffmpeg.org/ffmpeg.html
- android sdk
- android studio
- chrome
- 免费试听地址
启动时间
Cold startup takes 5 seconds or longer.
Warm startup takes 2 seconds or longer.
Hot startup takes 1.5 seconds or longer.
07-03 20:59:24.427 1126 1696 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.xueqiu.android/.view.WelcomeActivityAlias bnds=[276,1240][540,1529]} from uid 10050
07-03 20:59:24.435 1126 1696 I ActivityManager: ActivityRecord info: ActivityInfo{3f5e7aa com.xueqiu.android.view.WelcomeActivityAlias}
07-03 20:59:24.455 1126 2640 V ActivityManager: startProcess: name=com.xueqiu.android app=null knownToBeDead=true thread=null pid=-1
07-03 20:59:24.465 1126 2640 I ActivityManager: Start proc 11962:com.xueqiu.android/u0a208 for activity com.xueqiu.android/.view.WelcomeActivityAlias
07-03 20:59:24.467 1126 2640 V ActivityManager: startProcess: name=com.xueqiu.android app=ProcessRecord{c9074d 11962:com.xueqiu.android/u0a208} knownToBeDead=true thread=null pid=11962
07-03 20:59:24.487 1126 1696 D ActivityManager: ActivityManagerService,attachApplication,callingPid = 11962
07-03 20:59:24.569 1126 1696 D ActivityManager: Skipping, home or recents stack task: TaskRecord{cb84498 #1 A=com.huawei.android.launcher U=0 StackId=0 sz=1}
07-03 20:59:24.570 1126 1696 D ActivityManager: Skipping intent:flg=0x10804000 cmp=com.android.systemui/.recents.RecentsActivity bnds=[48,1316][1032,2576]
07-03 20:59:24.570 1126 1696 D ActivityManager: Skipping intent:flg=0x10800000 cmp=com.android.systemui/.usb.HwUsbDebuggingActivity
07-03 20:59:24.570 1126 1696 D ActivityManager: Skipping intent:flg=0x18800000 hwFlg=0x100 cmp=com.huawei.hifolder/.MainProxyActivity
07-03 20:59:24.721 1126 2644 V ActivityManager: startProcess: name=com.xueqiu.android:pushservice app=null knownToBeDead=true thread=null pid=-1
07-03 20:59:24.729 1126 2644 I ActivityManager: Start proc 12038:com.xueqiu.android:pushservice/u0a208 for service com.xueqiu.android/com.xiaomi.push.service.XMPushService
07-03 20:59:24.744 1126 2644 D ActivityManager: ActivityManagerService,attachApplication,callingPid = 12038
07-03 20:59:24.789 1126 1151 I ActivityManager: Displayed com.xueqiu.android/.view.WelcomeActivityAlias: +330ms
07-03 20:59:27.749 1126 2640 I ActivityManager: START u0 {flg=0x100000 pkg=com.xueqiu.android cmp=com.xueqiu.android/.common.MainActivity} from uid 10208
07-03 20:59:27.750 1126 2640 I ActivityManager: ActivityRecord info: ActivityInfo{70b3322 com.xueqiu.android.common.MainActivity}
07-03 20:59:27.918 1126 2640 D ActivityManager: Skipping, home or recents stack task: TaskRecord{cb84498 #1 A=com.huawei.android.launcher U=0 StackId=0 sz=1}
07-03 20:59:27.918 1126 2640 D ActivityManager: Skipping intent:flg=0x10804000 cmp=com.android.systemui/.recents.RecentsActivity bnds=[48,1316][1032,2576]
07-03 20:59:27.918 1126 2640 D ActivityManager: Skipping intent:flg=0x10800000 cmp=com.android.systemui/.usb.HwUsbDebuggingActivity
07-03 20:59:27.918 1126 2640 D ActivityManager: Skipping intent:flg=0x18800000 hwFlg=0x100 cmp=com.huawei.hifolder/.MainProxyActivity
07-03 20:59:28.297 1126 1151 I ActivityManager: Displayed com.xueqiu.android/.common.MainActivity: +461ms
07-03 20:59:33.032 1126 2640 V ActivityManager: startProcess: name=com.google.android.webview:sandboxed_process0 app=null knownToBeDead=true thread=null pid=-1
07-03 20:59:33.043 1126 2640 I ActivityManager: Start proc 12210:com.google.android.webview:sandboxed_process0/u0i16 for webview_service com.xueqiu.android/org.chromium.content.app.SandboxedProcessService0
07-03 20:59:33.062 1126 2046 D ActivityManager: ActivityManagerService,attachApplication,callingPid = 12210
查看activity的创建时���
package=com.xueqiu.android
清理缓存数据:adb shell pm clear $package
停止进程:adb shell am force-stop $package
启动app:adb shell am start -S -W $package/.view.WelcomeActivityAlias
获取数据:
localhost:~ seveniruby$ adb logcat |grep "Displayed "
07-03 21:08:54.054 1126 1151 I ActivityManager: Displayed com.xueqiu.android/.view.WelcomeActivityAlias: +345ms
07-03 21:08:57.542 1126 1151 I ActivityManager: Displayed com.xueqiu.android/.common.UpdateDialogActivity: +357ms (total +462ms)
录屏+拆帧
录屏
- screenrecord android自带的工具,但华为手机上没有
- 手机自带的录屏
- 摄像机独立录屏,比如很多公司的高速摄像机,不建议,设备昂贵而且自动化成本高
ffmpeg -i SVID_20190703_211522_1.mp4 -r 20 img-%03d.png
ffmpeg -i SVID_20190703_211522_1.mp4 -ss 00:00:09.85 -to 00:00:12.70 xueqiu.gif
!(/uploads/photo/2019/210225a5-e960-4a34-b9de-1228c6270adb.gif!large =400x)
手机浏览器测试
- 开发者工具webview调试 chrome://inspect
- https://developers.google.com/web/tools/chrome-devtools/network/reference#timing-explanation
webview
- 需要代理
- 需要chrome 62版本 高版本在一定情况下会有bug
- 找一个默认开启webview debug属性的模拟器,网易mumu就不行,genymotion、as自带的模拟器是可以的
- 真机上需要研发配合打开debug开关
- sdk版本要对
性能监控系统
- 生产环境 注入performance api
- 测试环境 appium selenium execute_script 注入
课后作业1
- 录制自己公司app的主界面的启动过程,给出启动时间统计,并把启动过程转成git动图贴到回复里
课后作业2
- 找出自己的公司官网,或者学院官网https://testing-studio.com/, 加载最慢的一个资源的timing数据贴到回复里并给出说明