Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
This commit is contained in:
Wenchao Hao 2025-05-15 17:30:00 +08:00
parent f9d461142a
commit 3c7abdcef8
2 changed files with 16 additions and 15 deletions

View File

@ -55,7 +55,7 @@ echo -e "$inc_ratio\t$inc_total" > $dir/ratio-"$app"-"$round".txt
sleep 3
adb pull /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace $dir/
adb pull /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace $dir/traces
adb pull /data/local/tmp/simpleperf-"$app"-"$round".txt $dir/
adb shell "rm /data/misc/perfetto-traces/trace-"$app"-"$round".ptrace"

29
run.sh
View File

@ -9,7 +9,8 @@ fi
dir=$(/usr/bin/date +%Y-%m%d-%H%M)
mkdir $dir
mkdir $dir/mminfo
mkdir $dir/system_mem
mkdir $dir/traces
echo "round app start_type start_time inc_ratio inc_total rss pss pagefaults itlbmiss dtlbmiss cpustall" > $dir/result
for round in $(seq 1 2); do
@ -17,27 +18,27 @@ for round in $(seq 1 2); do
sleep 3
# 抓内存相关信息
adb shell free -h > $dir/mminfo/before_free-$app-$round
adb shell cat /proc/meminfo > $dir/mminfo/before_meminfo-$app-$round
adb shell cat /proc/zoneinfo > $dir/mminfo/before_zoneinfo-$app-$round
adb shell cat /proc/buddyinfo > $dir/mminfo/before_buddyinfo-$app-$round
adb shell cat /proc/pagetypeinfo > $dir/mminfo/before_pagetypeinfo-$app-$round
adb shell cat /proc/vmstat > $dir/mminfo/before_vmstat-$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/zoneinfo > $dir/system_mem/before_zoneinfo-$app-$round
adb shell cat /proc/buddyinfo > $dir/system_mem/before_buddyinfo-$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
./cold_start_app.sh $app $round $dir
# 回到桌面,应用退后台
adb shell input keyevent 3
adb shell free -h > $dir/mminfo/after_free-$app-$round
adb shell cat /proc/meminfo > $dir/mminfo/after_meminfo-$app-$round
adb shell cat /proc/zoneinfo > $dir/mminfo/after_zoneinfo-$app-$round
adb shell cat /proc/buddyinfo > $dir/mminfo/after_buddyinfo-$app-$round
adb shell cat /proc/pagetypeinfo > $dir/mminfo/after_pagetypeinfo-$app-$round
adb shell cat /proc/vmstat > $dir/mminfo/after_vmstat-$app-$round
adb shell free -h > $dir/system_mem/after_free-$app-$round
adb shell cat /proc/meminfo > $dir/system_mem/after_meminfo-$app-$round
adb shell cat /proc/zoneinfo > $dir/system_mem/after_zoneinfo-$app-$round
adb shell cat /proc/buddyinfo > $dir/system_mem/after_buddyinfo-$app-$round
adb shell cat /proc/pagetypeinfo > $dir/system_mem/after_pagetypeinfo-$app-$round
adb shell cat /proc/vmstat > $dir/system_mem/after_vmstat-$app-$round
# 计算启动耗时
python3 handle_perfetto.py $dir/trace-"$app"-"$round".ptrace mm > tmp.txt
python3 handle_perfetto.py $dir/traces/trace-"$app"-"$round".ptrace mm > tmp.txt
if [ $(cat tmp.txt | wc -l) -ne 1 ]; then
start_time=0