Compare commits

...

9 Commits

Author SHA1 Message Date
Wenchao Hao 2690dc833d update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-16 09:52:27 +08:00
Wenchao Hao fc5b502b85 update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-15 22:03:32 +08:00
Wenchao Hao 905977eb72 update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-15 22:01:47 +08:00
Wenchao Hao 4b34fd300d update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-15 20:43:13 +08:00
Wenchao Hao df02fabca1 update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-12 21:47:44 +08:00
Wenchao Hao 78985b478a update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-12 21:46:40 +08:00
Wenchao Hao 242be13641 update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-12 17:25:49 +08:00
Wenchao Hao f5ec923ecc update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-12 17:25:14 +08:00
Wenchao Hao 2bf94d8a9a update
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
2025-09-12 17:22:21 +08:00
3 changed files with 64 additions and 42 deletions

26
applist
View File

@ -1,13 +1,17 @@
tv.danmaku.bili com.UCMobile
com.xingin.xhs
com.taobao.taobao com.taobao.taobao
com.ss.android.article.news com.qiyi.video
com.sina.weibo
com.smile.gifmaker
air.tv.douyu.android
com.ss.android.ugc.aweme.lite
com.kuaishou.nebula
com.sup.android.superb
com.ss.android.ugc.aweme com.ss.android.ugc.aweme
com.taobao.idlefish com.smile.gifmaker
com.duowan.kiwi com.kugou.android
com.xunmeng.pinduoduo
tv.danmaku.bili
com.tencent.qqlive
com.jingdong.app.mall
com.android.camera
com.tencent.tmgp.sgame
com.tencent.tmgp.pubgmhd
com.tencent.jkchess
com.miHoYo.Yuanshen
com.tencent.KiHan
com.miHoYo.enterprise.NGHSoD

View File

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

48
run.sh
View File

@ -1,11 +1,13 @@
#$dirput: round app start_time(ms) start_type rss(MB) pss(MB) ratio pagefault minorfaults majorfaults itlbmiss dtlbmiss cpustalled #$dirput: round app start_time(ms) start_type rss(MB) pss(MB) ratio pagefault minorfaults majorfaults itlbmiss dtlbmiss cpustalled
cycle=3 cycle=3
wait=3 WAIT=3
clear_background=0 clear_background=0
mthp_stat=0 mthp_stat=0
cleancache=0
REBOOT=0
while getopts ":s:c:w:h:kT" opt while getopts ":s:c:w:h:kTCR" opt
do do
case $opt in case $opt in
s) s)
@ -18,11 +20,17 @@ do
clear_background=1 clear_background=1
;; ;;
w) w)
wait=$OPTARG WAIT=$OPTARG
;;
R)
REBOOT=1
;; ;;
T) T)
mthp_stat=1 mthp_stat=1
;; ;;
C)
cleancache=1
;;
h) h)
echo "usage: run.sh -s sid -c cycle -w wait_seconds" echo "usage: run.sh -s sid -c cycle -w wait_seconds"
exit 1 exit 1
@ -32,6 +40,8 @@ do
echo "usage: run.sh -s sid -c cycle -w wait_time [-C]" echo "usage: run.sh -s sid -c cycle -w wait_time [-C]"
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 "-C: drop cache before start app"
echo "-R: reboot before each 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 "-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"
@ -68,9 +78,10 @@ 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 inc_total order4_ratio order4_cont nr_inc_direct_reclaim" >> $dir/result
for round in $(seq 1 $cycle); do for round in $(seq 1 $cycle); do
if [ $REBOOT -eq 1 ]; then
# 重启并等待重启完成 # 重启并等待重启完成
echo "rebooting" echo "rebooting"
adb reboot adb reboot
@ -88,6 +99,9 @@ for round in $(seq 1 $cycle); do
break break
done done
sleep 10
fi
adb root adb root
adb shell cat /sys/kernel/mm/transparent_hugepage/hugepages-64kB/enabled > $dir/hugepages-64kB_enabled adb shell cat /sys/kernel/mm/transparent_hugepage/hugepages-64kB/enabled > $dir/hugepages-64kB_enabled
adb shell cat /sys/kernel/mm/mthp_compact/enabled > $dir/mthp_compact_enabled adb shell cat /sys/kernel/mm/mthp_compact/enabled > $dir/mthp_compact_enabled
@ -108,6 +122,14 @@ for round in $(seq 1 $cycle); do
for app in `cat applist`; do for app in `cat applist`; do
sleep 3 sleep 3
if [ $clear_background -ne 0 ]; then
./clearapp.sh
fi
if [ $cleancache -ne 0 ]; then
adb shell "echo 3 > /proc/sys/vm/drop_caches"
fi
# 抓内存相关信息 # 抓内存相关信息
adb shell free -h > $dir/system_mem/before_free-$app-$round adb shell free -h > $dir/system_mem/before_free-$app-$round
adb shell cat /proc/meminfo > $dir/system_mem/before_meminfo-$app-$round adb shell cat /proc/meminfo > $dir/system_mem/before_meminfo-$app-$round
@ -116,11 +138,6 @@ for round in $(seq 1 $cycle); do
adb shell cat /proc/pagetypeinfo > $dir/system_mem/before_pagetypeinfo-$app-$round adb shell cat /proc/pagetypeinfo > $dir/system_mem/before_pagetypeinfo-$app-$round
adb shell cat /proc/vmstat > $dir/system_mem/before_vmstat-$app-$round adb shell cat /proc/vmstat > $dir/system_mem/before_vmstat-$app-$round
# 开始抓simpleperf和perfetto
adb shell "simpleperf stat -e dTLB-loads,dTLB-load-misses,iTLB-loads,iTLB-load-misses,page-faults,raw-stall-backend-mem,minor-faults,major-faults --app $app --duration 3 -o /data/local/tmp/simpleperf-"$app"-"$round".txt" &
adb shell "perfetto -c /data/misc/perfetto-configs/perfconf.txt --txt -o /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace" &
perfetto_pid=$!
# 获取应用activity # 获取应用activity
if [ "$app" == "com.qiyi.video" ]; then if [ "$app" == "com.qiyi.video" ]; then
activity="com.qiyi.video/com.qiyi.video.WelcomeActivity" activity="com.qiyi.video/com.qiyi.video.WelcomeActivity"
@ -145,13 +162,18 @@ for round in $(seq 1 $cycle); do
# 抓电池信息 # 抓电池信息
adb shell "dumpsys battery" > $dir/battery/battery-$app-$round adb shell "dumpsys battery" > $dir/battery/battery-$app-$round
# 开始抓simpleperf和perfetto
adb shell "simpleperf stat -e dTLB-loads,dTLB-load-misses,iTLB-loads,iTLB-load-misses,page-faults,raw-stall-backend-mem,minor-faults,major-faults --app $app --duration 3 -o /data/local/tmp/simpleperf-"$app"-"$round".txt" &
adb shell "perfetto -c /data/misc/perfetto-configs/perfconf.txt --txt -o /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace" &
perfetto_pid=$!
prev_alloc=$(adb shell cat /sys/kernel/mm/transparent_hugepage/hugepages-64kB/stats/anon_fault_alloc) prev_alloc=$(adb shell cat /sys/kernel/mm/transparent_hugepage/hugepages-64kB/stats/anon_fault_alloc)
prev_alloc_fallback=$(adb shell cat /sys/kernel/mm/transparent_hugepage/hugepages-64kB/stats/anon_fault_fallback) prev_alloc_fallback=$(adb shell cat /sys/kernel/mm/transparent_hugepage/hugepages-64kB/stats/anon_fault_fallback)
# 启动应用 # 启动应用
adb shell am start -n $activity adb shell am start -n $activity
# 睡眠15s并等待perfetto退出 # 睡眠10s并等待perfetto退出
sleep 10 sleep 10
wait wait
@ -172,7 +194,7 @@ for round in $(seq 1 $cycle); do
adb shell cat /proc/vmstat > $dir/system_mem/after_vmstat-$app-$round adb shell cat /proc/vmstat > $dir/system_mem/after_vmstat-$app-$round
# 睡眠3s后拉simpleperf和perfetto数据 # 睡眠3s后拉simpleperf和perfetto数据
sleep $wait sleep $WAIT
adb pull /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace $dir/traces adb pull /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace $dir/traces
adb pull /data/local/tmp/simpleperf-"$app"-"$round".txt $dir/simpleperf/ adb pull /data/local/tmp/simpleperf-"$app"-"$round".txt $dir/simpleperf/
adb shell "rm /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace" adb shell "rm /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace"
@ -243,10 +265,6 @@ for round in $(seq 1 $cycle); do
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 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
./clearapp.sh
fi
rm tmp.txt rm tmp.txt
done done
done done