Activity start process
Application OnCreate
- Load third-party sdk
Activity OnCreate
- Load its own logic
- Send remote data request
- Rendering interface
APP startup performance indicators
- Cold start: the most important start indicator, focusing on optimization, the recommended time is 5 seconds
- Warm start: recommended time 2 seconds
- Hot start: recommended time 1.5 seconds
- First screen launch
The main process of the test
- adb logcat: not accurate enough
- Screen recording + video deframing: more accurate, requiring manual operation
- Automated tools such as uiautomator for 200ms inspection interface change
- traceview
- Hard burying point: the most accurate, and the coverage is wider
adb logcat
- Clean up cached data:
adb shell pm clear package
- Stop the process:
adb shell am force-stop package
- Start the APP:
adb shell am start -S -W package/activity
- Get data:
adb logcat | grep -i displayed
Get the result through adb logcat:
- startTime: Record the time when startActivityAndWait() was just about to be called
- endTime: record the time point when the startActivityAndWait() function call returns
- waitTime: startActivityAndWait() call takes time; waitTime = endTime-startTime
Use ffmpeg to deframe
- Clear application cache:
adb shell am force-stop package
to the designated address of the phone: 16136e3cb1e540 adb shell screenrecord --bugreport --time-limit 30 Screen recording file path &
- Start the APP and jump to the specified interface:
adb shell am start -S -W package/activity
- Pull the screen recording file from the mobile phone to the computer:
adb pull The storage path of the screen recording file path
- Convert video to gif format:
ffmpeg -i screen recording file split format
- Split the video into 10 frames per second and store it as a jpg format picture:
ffmpeg -i screen recording file -r 10 frames_%03d.jpg
- Then analyze the picture frame by frame to find the click time and the time to open the specified interface, so as to calculate the startup time
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。