Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
This commit is contained in:
Wenchao Hao 2025-09-16 09:52:27 +08:00
parent fc5b502b85
commit 2690dc833d
1 changed files with 7 additions and 6 deletions

13
run.sh
View File

@ -41,6 +41,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 "-C: drop cache before start app" 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"
@ -137,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"
@ -166,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