Compare commits

..

No commits in common. "eaa21b20af7343e4bd8ce1c07fb40690562cf0da" and "f2039d631c12cfc1595a33f4766ede076a726877" have entirely different histories.

4 changed files with 34 additions and 49 deletions

27
applist
View File

@ -1,13 +1,40 @@
tv.danmaku.bili tv.danmaku.bili
com.xingin.xhs com.xingin.xhs
com.jingdong.app.mall
com.taobao.taobao com.taobao.taobao
com.xunmeng.pinduoduo
com.ss.android.article.news com.ss.android.article.news
com.sina.weibo com.sina.weibo
com.tencent.mobileqq
com.tencent.qqlive
com.smile.gifmaker com.smile.gifmaker
com.netease.cloudmusic
air.tv.douyu.android air.tv.douyu.android
com.autonavi.minimap
com.sankuai.meituan
com.tencent.mm
com.eg.android.AlipayGphone
com.ss.android.ugc.aweme.lite com.ss.android.ugc.aweme.lite
com.kuaishou.nebula com.kuaishou.nebula
com.sup.android.superb com.sup.android.superb
com.baidu.searchbox
com.tencent.weread
com.tencent.tmgp.sgame
com.qiyi.video
com.UCMobile
com.ss.android.ugc.aweme com.ss.android.ugc.aweme
com.taobao.idlefish com.taobao.idlefish
com.happyelements.AndroidAnimal
com.android.deskclock
com.tencent.qqmusic
com.android.camera
com.tencent.mtt
com.dragon.read
com.baidu.tieba
com.miHoYo.Yuanshen
com.quark.browser
com.tencent.tmgp.pubgmhd
com.tencent.jkchess
com.kmxs.reader
com.ss.android.article.lite
com.duowan.kiwi com.duowan.kiwi

View File

@ -9,7 +9,7 @@ def clear_all_apps():
try: try:
d.keyevent("HOME") d.keyevent("HOME")
d.keyevent("HOME") d.keyevent("HOME")
d.keyevent("312") d.keyevent("MENU")
time.sleep(1) time.sleep(1)
if "com.miui.home:id/recents_container" not in d.dump_hierarchy(): if "com.miui.home:id/recents_container" not in d.dump_hierarchy():
continue continue

View File

@ -98,5 +98,5 @@ data_sources: {
} }
} }
} }
duration_ms: 20000 duration_ms: 8000

52
run.sh
View File

@ -5,7 +5,7 @@ wait=3
clear_background=0 clear_background=0
mthp_stat=0 mthp_stat=0
while getopts ":s:c:w:h:kT" opt while getopts ":s:c:w:h:C:T" opt
do do
case $opt in case $opt in
s) s)
@ -14,7 +14,7 @@ do
c) c)
cycle=$OPTARG cycle=$OPTARG
;; ;;
k) C)
clear_background=1 clear_background=1
;; ;;
w) w)
@ -33,7 +33,7 @@ do
echo "-s: specify serial id of device" echo "-s: specify serial id of device"
echo "-c: specify applist startup cycle" echo "-c: specify applist startup cycle"
echo "-w: specify wait time after app start, before start next app, default 10 s" echo "-w: specify wait time after app start, before start next app, default 10 s"
echo "-k: if to kill all background apps before start app" echo "-C: if to kill all background apps before start app"
echo "-T: if check app's mTHP status" echo "-T: if check app's mTHP status"
exit 1 exit 1
;; ;;
@ -68,42 +68,9 @@ mkdir $dir/meminfo
mkdir $dir/simpleperf mkdir $dir/simpleperf
mkdir $dir/thpmaps mkdir $dir/thpmaps
echo "round app start_type start_time rss pss pagefaults minorfaults majorfaults itlbmiss dtlbmiss cpustall inc_ratio order4_ratio order4_cont inc_total nr_direct_reclaim" > $dir/result echo "round app start_type start_time rss pss pagefaults minorfaults majorfaults itlbmiss dtlbmiss cpustall inc_ratio order4_ratio order4_cont inc_total" > $dir/result
for round in $(seq 1 $cycle); do for round in $(seq 1 $cycle); do
# 重启并等待重启完成
echo "rebooting"
adb reboot
sleep 30
# 重启后等待adb
# 如果10min还未成功则判断失败
for w in $(seq 1 600); do
if [ $(adb devices | grep $ANDROID_SERIAL -c) -eq 0 ]; then
echo waiting device $w
sleep 1
continue
fi
adb root
break
done
# adb连接后睡眠60s
sleep 60
# 解锁手机
~/.scripts/android/unlock.sh
# 等待降温
for f in $(seq 1 900); do
temp=$(adb shell dumpsys battery | grep temperature | awk '{print $2}')
if [ $temp -gt 300 ]; then
echo [$f] now temperature is $temp
sleep 1
continue
fi
break
done
for app in `cat applist`; do for app in `cat applist`; do
sleep 3 sleep 3
@ -125,10 +92,6 @@ for round in $(seq 1 $cycle); do
activity="com.qiyi.video/com.qiyi.video.WelcomeActivity" activity="com.qiyi.video/com.qiyi.video.WelcomeActivity"
elif [ "$app" == "com.netease.cloudmusic" ]; then elif [ "$app" == "com.netease.cloudmusic" ]; then
activity="com.netease.cloudmusic/com.netease.cloudmusic.activity.IconChangeDefaultAlias" activity="com.netease.cloudmusic/com.netease.cloudmusic.activity.IconChangeDefaultAlias"
elif [ "$app" == "com.ss.android.ugc.aweme" ]; then
activity="com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.splash.SplashActivity"
elif [ "$app" == "com.ss.android.ugc.aweme.lite" ]; then
activity="com.ss.android.ugc.aweme.lite/com.ss.android.ugc.aweme.splash.SplashActivity"
else else
activity=$(adb shell dumpsys package $app | grep -A 1 -w "android.intent.action.MAIN:" | head -n 2 | tail -n 1 | awk '{print $2}') activity=$(adb shell dumpsys package $app | grep -A 1 -w "android.intent.action.MAIN:" | head -n 2 | tail -n 1 | awk '{print $2}')
fi fi
@ -235,12 +198,7 @@ for round in $(seq 1 $cycle); do
minorfaults=$(cat $dir/simpleperf/simpleperf-"$app"-"$round".txt | grep 'minor-faults' | awk '{print $1}' | sed s/,//) minorfaults=$(cat $dir/simpleperf/simpleperf-"$app"-"$round".txt | grep 'minor-faults' | awk '{print $1}' | sed s/,//)
majorfaults=$(cat $dir/simpleperf/simpleperf-"$app"-"$round".txt | grep 'major-faults' | awk '{print $1}' | sed s/,//) majorfaults=$(cat $dir/simpleperf/simpleperf-"$app"-"$round".txt | grep 'major-faults' | awk '{print $1}' | sed s/,//)
# 计算直接内存回收次数 echo $round $app $start_type $start_time $rss $pss $pagefaults $minorfaults $majorfaults $itlbmiss $dtlbmiss $cpustall $inc_ratio $inc_total $order4_ratio $order4_cont>> $dir/result
nr_init_direct_reclaim=$(cat $dir/system_mem/after_vmstat-$app-$round | grep pgscan_direct_throttle | awk '{print $2}')
nr_direct_reclaim=$(cat $dir/system_mem/before_vmstat-$app-$round | grep pgscan_direct_throttle | awk '{print $2}')
nr_inc_direct_reclaim=$((nr_direct_reclaim-nr_init_direct_reclaim))
echo $round $app $start_type $start_time $rss $pss $pagefaults $minorfaults $majorfaults $itlbmiss $dtlbmiss $cpustall $inc_ratio $inc_total $order4_ratio $order4_cont $nr_inc_direct_reclaim >> $dir/result
if [ $clear_background -ne 0 ]; then if [ $clear_background -ne 0 ]; then
python3 clear_apps.py python3 clear_apps.py