Compare commits

...

5 Commits

Author SHA1 Message Date
Wenchao Hao eaa21b20af update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-02 10:20:22 +08:00
Wenchao Hao 8030647b8e update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-01 20:58:26 +08:00
Wenchao Hao ca92899c4a update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-01 20:13:49 +08:00
Wenchao Hao 4e9d777d30 update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-01 17:10:09 +08:00
Wenchao Hao 7c16407aad update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-01 15:24:53 +08:00
4 changed files with 49 additions and 34 deletions

27
applist
View File

@ -1,40 +1,13 @@
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("MENU") d.keyevent("312")
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: 8000 duration_ms: 20000

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:C:T" opt while getopts ":s:c:w:h:kT" opt
do do
case $opt in case $opt in
s) s)
@ -14,7 +14,7 @@ do
c) c)
cycle=$OPTARG cycle=$OPTARG
;; ;;
C) k)
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 "-C: if to kill all background apps before start app" echo "-k: 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,9 +68,42 @@ 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" > $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 nr_direct_reclaim" > $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
@ -92,6 +125,10 @@ 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
@ -198,7 +235,12 @@ 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