线下班第二期_专项测试基础_20180505

有疑问可回帖

今天内容

崩溃检测

性能分析

adb shell dumpsys procstats --hours 3
adb shell dumpsys meminfo package_name|pid [-d]
adb shell dumpsys batterystats --charged package-name
adb shell dumpsys netstats detail
adb shell dumpsys gfxinfo package-name

Method Profile

使用ddms分析调用耗时。

monitor工具需要低版本的JDK8,可以使用这个版本
http://download.oracle.com/otn/java/jdk/8u51-b16/jdk-8u51-macosx-x64.dmg?AuthParam=1525588656_1cd0799fdeffac3e987e4f8faa4e1556

  • 使用monitor的dump heap hprof文件
  • 把生成的hprof文件保存
  • 转成java支持的格式
  • 借助于visualvm进行分析,了解内存分配情况

其实命令行也可以做到

am profile start [--user <USER_ID> current] [--sampling INTERVAL] <PROCESS> <FILE>
am profile stop [--user <USER_ID> current] [<PROCESS>]
am dumpheap [--user <USER_ID> current] [-n] <PROCESS> <FILE>
hprof-conv com.xueqiu.android_0506.hprof com.xueqiu.android_0506_java.hprof

耗电量分析

https://github.com/google/battery-historian

git clone https://github.com/google/battery-historian.git
cd battery-historian
go get -d -u github.com/google/battery-historian/...
go run setup.go
go run cmd/battery-historian/battery-historian.go
#清理耗电量数据 
adb shell dumpsys batterystats --reset
adb shell dumpsys batterystats --enable full-wake-history
#运行测试用例
appium uiautomator
#收集耗电量数据
#>=7.0 
adb bugreport bugreport.zip
#<=6.0 
adb bugreport > bugreport.txt


作业

分析雪球各界面加载

分析webview性能

检测浏览器页面耗时时间

检测自己的手机耗电元凶

分析app某个界面从点击到界面展现发生的主要过程和关键耗时过程。

明天课程

代码插桩

代码hook