From f2039d631c12cfc1595a33f4766ede076a726877 Mon Sep 17 00:00:00 2001 From: Wenchao Hao Date: Tue, 27 May 2025 14:21:59 +0800 Subject: [PATCH] Add cmdline to enable check mthp status Signed-off-by: Wenchao Hao --- run.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/run.sh b/run.sh index 6963e85..1b4a29a 100755 --- a/run.sh +++ b/run.sh @@ -3,8 +3,9 @@ cycle=3 wait=3 clear_background=0 +mthp_stat=0 -while getopts ":s:c:w:h:C" opt +while getopts ":s:c:w:h:C:T" opt do case $opt in s) @@ -19,6 +20,9 @@ do w) wait=$OPTARG ;; + T) + mthp_stat=1 + ;; h) echo "usage: run.sh -s sid -c cycle -w wait_seconds" exit 1 @@ -30,6 +34,7 @@ do echo "-c: specify applist startup cycle" 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 "-T: if check app's mTHP status" exit 1 ;; esac @@ -176,10 +181,15 @@ for round in $(seq 1 $cycle); do fi # 计算大页占比 - 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 - 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') + if [ $mthp_stat -eq 1 ]; then + 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 + 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') + else + order4_ratio=0 + order4_cont=0 + fi 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}')