Add cmdline to enable check mthp status

Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
This commit is contained in:
Wenchao Hao 2025-05-27 14:21:59 +08:00
parent b3a78b5960
commit f2039d631c
1 changed files with 15 additions and 5 deletions

12
run.sh
View File

@ -3,8 +3,9 @@
cycle=3 cycle=3
wait=3 wait=3
clear_background=0 clear_background=0
mthp_stat=0
while getopts ":s:c:w:h:C" opt while getopts ":s:c:w:h:C:T" opt
do do
case $opt in case $opt in
s) s)
@ -19,6 +20,9 @@ do
w) w)
wait=$OPTARG wait=$OPTARG
;; ;;
T)
mthp_stat=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
@ -30,6 +34,7 @@ do
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 "-C: if to kill all background apps before start app"
echo "-T: if check app's mTHP status"
exit 1 exit 1
;; ;;
esac esac
@ -176,10 +181,15 @@ for round in $(seq 1 $cycle); do
fi fi
# 计算大页占比 # 计算大页占比
if [ $mthp_stat -eq 1 ]; then
app_pid=$(adb shell "ps -ef" | grep $app | head -n 1 | awk '{print $2}') app_pid=$(adb shell "ps -ef" | grep $app | head -n 1 | awk '{print $2}')
python3 thpmaps_v3_vir_cont.py --pid $app_pid --rollup --inc-empty --cont 64k > $dir/thpmaps/thp-$app-$round python3 thpmaps_v3_vir_cont.py --pid $app_pid --rollup --inc-empty --cont 64k > $dir/thpmaps/thp-$app-$round
order4_ratio=$(cat $dir/thpmaps/thp-$app-$round | grep "anon-thp-pte-aligned-64kB" | awk -F '(' '{print $2}' | sed 's/)//g') order4_ratio=$(cat $dir/thpmaps/thp-$app-$round | grep "anon-thp-pte-aligned-64kB" | awk -F '(' '{print $2}' | sed 's/)//g')
order4_cont=$(cat $dir/thpmaps/thp-$app-$round | grep "anon-cont-pte-aligned-64kB" | awk -F '(' '{print $2}' | sed 's/)//g') order4_cont=$(cat $dir/thpmaps/thp-$app-$round | grep "anon-cont-pte-aligned-64kB" | awk -F '(' '{print $2}' | sed 's/)//g')
else
order4_ratio=0
order4_cont=0
fi
pagefaults=$(cat $dir/simpleperf/simpleperf-"$app"-"$round".txt | grep 'page-faults' | awk '{print $4}') pagefaults=$(cat $dir/simpleperf/simpleperf-"$app"-"$round".txt | grep 'page-faults' | awk '{print $4}')
itlbmiss=$(cat $dir/simpleperf/simpleperf-"$app"-"$round".txt | grep 'iTLB-load-misses' | awk '{print $4}') itlbmiss=$(cat $dir/simpleperf/simpleperf-"$app"-"$round".txt | grep 'iTLB-load-misses' | awk '{print $4}')