Compare commits

..

No commits in common. "2690dc833d4e30ccbbbbbc005f265a2dcf1981d8" and "c7a76019a96b6efca4b07c8130b9ed0eea800027" have entirely different histories.

3 changed files with 43 additions and 65 deletions

28
applist
View File

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

View File

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

48
run.sh
View File

@ -1,13 +1,11 @@
#$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:kTCR" opt while getopts ":s:c:w:h:kT" opt
do do
case $opt in case $opt in
s) s)
@ -20,17 +18,11 @@ 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
@ -40,8 +32,6 @@ 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"
@ -78,10 +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 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 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
if [ $REBOOT -eq 1 ]; then
# 重启并等待重启完成 # 重启并等待重启完成
echo "rebooting" echo "rebooting"
adb reboot adb reboot
@ -99,9 +88,6 @@ 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
@ -122,14 +108,6 @@ 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
@ -138,6 +116,11 @@ 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"
@ -162,18 +145,13 @@ 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
# 睡眠10s并等待perfetto退出 # 睡眠15s并等待perfetto退出
sleep 10 sleep 10
wait wait
@ -194,7 +172,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"
@ -265,6 +243,10 @@ 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