Benchmark: compile with the baseline profile only, find off-screen rows

The app is now compiled the way Macrobenchmark's Partial mode does it,
so runs compare baseline profiles instead of what the JIT learned in a
warm-up run. Tapping a row scrolls the list when the row is off screen.
This commit is contained in:
2026-10-25 12:35:23 +02:00
parent 603e90dcca
commit 9e744b309e
2 changed files with 23 additions and 9 deletions
+5 -2
View File
@@ -23,7 +23,8 @@ tap_text() {
import re, sys import re, sys
xml, text = sys.stdin.read(), sys.argv[1] xml, text = sys.stdin.read(), sys.argv[1]
for node in re.findall(r"<node [^>]*>", xml): for node in re.findall(r"<node [^>]*>", xml):
if re.search(r"(text|content-desc)=\"%s\"" % re.escape(text), node): # Compose merges a clickable row into one node: "System, 3 of 5"
if re.search(r"(text|content-desc)=\"%s(\"|, )" % re.escape(text), node):
x1, y1, x2, y2 = map(int, re.search(r"bounds=\"\[(\d+),(\d+)\]\[(\d+),(\d+)\]\"", node).groups()) x1, y1, x2, y2 = map(int, re.search(r"bounds=\"\[(\d+),(\d+)\]\[(\d+),(\d+)\]\"", node).groups())
print((x1 + x2) // 2, (y1 + y2) // 2) print((x1 + x2) // 2, (y1 + y2) // 2)
break break
@@ -32,6 +33,8 @@ for node in re.findall(r"<node [^>]*>", xml):
adb shell input tap $xy adb shell input tap $xy
return 0 return 0
fi fi
# Lazy lists only show what is on screen; with "scroll", look further down
[[ "${2:-}" == scroll ]] && adb shell input swipe $((W / 2)) $((H * 2 / 3)) $((W / 2)) $((H / 3)) 300
sleep 1 sleep 1
done done
echo "::warning::'$1' not found on screen" echo "::warning::'$1' not found on screen"
@@ -51,7 +54,7 @@ for _ in 1 2 3; do
swipe swipe
tap_text "Monitor"; sleep 2 tap_text "Monitor"; sleep 2
tap_text "Apps"; sleep 3 tap_text "Apps"; sleep 3
tap_text "System"; sleep 2 tap_text "System" scroll; sleep 2
swipe swipe
tap_text "Blocklist"; sleep 2 tap_text "Blocklist"; sleep 2
swipe swipe
+18 -7
View File
@@ -25,11 +25,15 @@ record() { echo "$1,$2,$3" >> "$RAW"; } # name,metric,value
install() { install() {
adb uninstall "$PKG" >/dev/null 2>&1 adb uninstall "$PKG" >/dev/null 2>&1
adb install -g "$1" >/dev/null adb install -g "$1" >/dev/null
# The first run lets ProfileInstaller store the profile, then the app is compiled
# the way the device does it in the background after an install
adb shell am start -W -n "$ACT" >/dev/null adb shell am start -W -n "$ACT" >/dev/null
sleep 12 sleep 2
adb shell am force-stop "$PKG" adb shell am force-stop "$PKG"
# Compiles with the APK's baseline profile only, as the device does after an install,
# without what the JIT learned during the first run (same as Macrobenchmark's Partial mode)
adb shell cmd package compile --reset "$PKG" >/dev/null
adb shell am broadcast -f 0x20 -a androidx.profileinstaller.action.INSTALL_PROFILE \
"$PKG/androidx.profileinstaller.ProfileInstallReceiver" | tr -d '\r' | grep -o 'result=[0-9-]*'
sleep 2
adb shell cmd package compile -f -m speed-profile "$PKG" >/dev/null adb shell cmd package compile -f -m speed-profile "$PKG" >/dev/null
} }
@@ -87,7 +91,7 @@ background_memory() {
sleep 3 sleep 3
tap_text "Apps" || return tap_text "Apps" || return
sleep 2 sleep 2
tap_text "System" tap_text "System" scroll
sleep 2 sleep 2
for _ in 1 2 3 4; do for _ in 1 2 3 4; do
adb shell input swipe $((W / 2)) $((H * 3 / 4)) $((W / 2)) $((H / 4)) 200 adb shell input swipe $((W / 2)) $((H * 3 / 4)) $((W / 2)) $((H / 4)) 200
@@ -108,7 +112,8 @@ tap_text() {
import re, sys import re, sys
xml, text = sys.stdin.read(), sys.argv[1] xml, text = sys.stdin.read(), sys.argv[1]
for node in re.findall(r"<node [^>]*>", xml): for node in re.findall(r"<node [^>]*>", xml):
if re.search(r"(text|content-desc)=\"%s\"" % re.escape(text), node): # Compose merges a clickable row into one node: "System, 3 of 5"
if re.search(r"(text|content-desc)=\"%s(\"|, )" % re.escape(text), node):
x1, y1, x2, y2 = map(int, re.search(r"bounds=\"\[(\d+),(\d+)\]\[(\d+),(\d+)\]\"", node).groups()) x1, y1, x2, y2 = map(int, re.search(r"bounds=\"\[(\d+),(\d+)\]\[(\d+),(\d+)\]\"", node).groups())
print((x1 + x2) // 2, (y1 + y2) // 2) print((x1 + x2) // 2, (y1 + y2) // 2)
break break
@@ -117,6 +122,8 @@ for node in re.findall(r"<node [^>]*>", xml):
adb shell input tap $xy adb shell input tap $xy
return 0 return 0
fi fi
# Lazy lists only show what is on screen; with "scroll", look further down
[[ "${2:-}" == scroll ]] && adb shell input swipe $((W / 2)) $((H * 2 / 3)) $((W / 2)) $((H / 3)) 300
sleep 1 sleep 1
done done
echo "::warning::'$1' not found on screen" echo "::warning::'$1' not found on screen"
@@ -130,8 +137,12 @@ jank() {
sleep 3 sleep 3
tap_text "Apps" || return tap_text "Apps" || return
sleep 2 sleep 2
tap_text "System" # the only group collapsed by default tap_text "System" scroll # the only group collapsed by default, listed last
sleep 3 sleep 2
for _ in 1 2 3; do
adb shell input swipe $((W / 2)) $((H / 4)) $((W / 2)) $((H * 3 / 4)) 100
done
sleep 2
adb shell dumpsys gfxinfo "$PKG" reset >/dev/null adb shell dumpsys gfxinfo "$PKG" reset >/dev/null
for dir in down down down down down up up up up up; do for dir in down down down down down up up up up up; do
if [[ $dir == down ]]; then if [[ $dir == down ]]; then