From 58a97bb7b8781010c09f1b9053b53f101583d28c Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 8 Oct 2026 16:05:01 -0400 Subject: [PATCH] Bench session stops the anland app at start and relaunches it at stop, so FCL keeps the foreground. --- tools/device_bench/disagg/bench_session.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/device_bench/disagg/bench_session.sh b/tools/device_bench/disagg/bench_session.sh index 5f75b349..3a5ca91d 100644 --- a/tools/device_bench/disagg/bench_session.sh +++ b/tools/device_bench/disagg/bench_session.sh @@ -9,8 +9,12 @@ # game-mode levels land in /sys/kernel/msm_performance/parameters/cpu_{max,min}_freq, a # frequency QoS that clamps scaling_max_freq below any pin (measured 2026-10-08: 787 / 1286 / # 1075 / 1248 MHz on policies 0/2/5/7 while pin_clocks.sh believed it had pinned 2035 MHz); -# 3. releases those requests and re-pins (pin_clocks.sh). -# stop: starts every service that was running before start, and verifies each is running again. +# 3. releases those requests and re-pins (pin_clocks.sh); +# 4. force-stops the anland desktop app, recording whether it ran. Its activity takes the +# foreground back whenever it is paused, so FCL launched over it never reaches the world +# (2026-10-08: a job's own end-of-run relaunch left it up and the next job got 0 of 4 worlds). +# stop: starts every service that was running before start, and verifies each is running again; +# relaunches the anland app if it ran before start (keeps anland usable). # ALWAYS run it - callers trap it on EXIT/INT/TERM, so an interrupted session restores too. # Kernel-level protection (LMh, BCL, kernel thermal trip points) is never touched; the run's sampler # (freq_sampler.sh -> freqcheck.py) shows any frequency collapse, and a collapse ends benchmarking. @@ -21,10 +25,12 @@ HERE="$(cd "$(dirname "$0")" && pwd)" SERVICES="${BENCH_STOP_SERVICES:-thermal-engine perf2-hal-1-0 vendor.perfservice performance hyperschedule_hal_service}" MARK=/data/local/tmp/p15-bench-session MP=/sys/kernel/msm_performance/parameters +ANLAND=com.anland.consumer.mobilegl su_sh() { adb -s "$SER" shell "su -c '$1'"; } case "${1:-status}" in start) - su_sh "if [ ! -f $MARK ]; then for s in $SERVICES; do echo svc \$s \$(getprop init.svc.\$s); done > $MARK; echo maxreq \$(cat $MP/cpu_max_freq) >> $MARK; echo minreq \$(cat $MP/cpu_min_freq) >> $MARK; fi; cat $MARK" + su_sh "if [ ! -f $MARK ]; then for s in $SERVICES; do echo svc \$s \$(getprop init.svc.\$s); done > $MARK; echo maxreq \$(cat $MP/cpu_max_freq) >> $MARK; echo minreq \$(cat $MP/cpu_min_freq) >> $MARK; echo anland \$(pidof $ANLAND >/dev/null && echo running || echo stopped) >> $MARK; fi; cat $MARK" + su_sh "am force-stop $ANLAND" su_sh "for s in $SERVICES; do setprop ctl.stop \$s; done" sleep 2 su_sh "echo \"0:4294967295 1:4294967295 2:4294967295 3:4294967295 4:4294967295 5:4294967295 6:4294967295 7:4294967295\" > $MP/cpu_max_freq; echo \"0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0\" > $MP/cpu_min_freq" @@ -38,6 +44,7 @@ case "${1:-status}" in sleep 3 bad=$(su_sh "if [ -f $MARK ]; then grep \"^svc \" $MARK | while read k s st; do [ \"\$st\" = running ] && [ \"\$(getprop init.svc.\$s)\" != running ] && echo \$s; done; fi" | tr -d '\r') if [ -n "$bad" ]; then echo "bench_session: NOT RESTORED: $bad" >&2; exit 1; fi + su_sh "if grep -q \"^anland running\" $MARK 2>/dev/null; then monkey -p $ANLAND -c android.intent.category.LAUNCHER 1 >/dev/null 2>&1; fi" su_sh "rm -f $MARK" "$0" status ;; status)