Implements RUST.md's "Benchmark v2" spec in bench_client.rs: fling (8 out + 8 back at 12,000px/s through List::fling, waits for !is_scrolling() capped 3s, reports travel as row index + offset via List's new anchor_position_display), stream (unchanged), type (the 600-char P0 constant, one char per 50ms into the composer's real TextEdit via .set(), then deleted), and keyboard (5 show/hide cycles via bench_jni.rs's new InputMethodManager calls, confirmed from on_insets_changed's real ime_bottom transitions rather than assumed from the JNI call returning). FrameReport gained mark_phase/phase_stats/late_at_hz (iris/core) so the report can show a per-phase block (frames, late%, p50/p90/p99, worst) against the display's real refresh rate (bench_jni's new refresh_rate_hz), matching the shape docs/bench/compose-phone-v2 uses. RING_CAPACITY bumped 4096->16384 since a full v2 run is ~3,000+ frames. Found and fixed a real deadlock while wiring this up: read_from_state (a new helper that gets a value back out of a spawned task's ctx.update, which has no return channel of its own) only worked for its first call in a chain, because nothing called redraw.request_redraw() after enqueueing later ones -- nothing then drains the task channel to run them. Every call now triggers its own redraw. Verified end to end on this checkout's x86_64 emulator (force-gles, cold boot): fling/stream/type all report populated phase blocks; keyboard's show never got a real on_insets_changed confirmation this run (see follow-up work). Full report and travel numbers go in RUST.md's P0 box next. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
70 lines
2.6 KiB
Bash
Executable File
70 lines
2.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# Installs and runs the iris `bench` build on this checkout's own emulator
|
|
# (per this-machine-android's per-checkout-AVD rule; `emu serial` picks it)
|
|
# and prints the report -- the iris half of `app/transcript-bench.sh`'s
|
|
# job. No coordinates: the button is found by its accessibility label
|
|
# through `ui-trace`, per AGENTS.md's "Driving the UI".
|
|
#
|
|
# Usage: ./run-bench.sh [--apk PATH]
|
|
# Defaults to this checkout's own release APK
|
|
# (app/build/outputs/apk/release/app-release.apk) if it exists, else the
|
|
# debug one -- build one first with ./build-apk.sh.
|
|
set -eu
|
|
cd "$(dirname "$0")"
|
|
|
|
APK=""
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--apk) APK="$2"; shift 2 ;;
|
|
*) echo "run-bench.sh: unknown argument: $1" >&2; exit 1 ;;
|
|
esac
|
|
done
|
|
if [ -z "$APK" ]; then
|
|
if [ -f app/build/outputs/apk/release/app-release.apk ]; then
|
|
APK=app/build/outputs/apk/release/app-release.apk
|
|
else
|
|
APK=app/build/outputs/apk/debug/app-debug.apk
|
|
fi
|
|
fi
|
|
if [ ! -f "$APK" ]; then
|
|
echo "run-bench.sh: no APK at $APK -- run ./build-apk.sh first" >&2
|
|
exit 1
|
|
fi
|
|
|
|
SERIAL=$(emu serial)
|
|
PKG=$(aapt2 dump badging "$APK" 2>/dev/null | sed -n "s/^package: name='\\([^']*\\)'.*/\\1/p")
|
|
if [ -z "$PKG" ]; then
|
|
BUILD_TOOLS=$(ls -d "$HOME"/Android/Sdk/build-tools/*/ | sort -V | tail -1)
|
|
PKG=$("${BUILD_TOOLS}aapt2" dump badging "$APK" | sed -n "s/^package: name='\\([^']*\\)'.*/\\1/p")
|
|
fi
|
|
|
|
echo "run-bench.sh: installing $APK ($PKG) on $SERIAL"
|
|
adb -s "$SERIAL" install -r "$APK" >/dev/null
|
|
adb -s "$SERIAL" shell am force-stop "$PKG"
|
|
adb -s "$SERIAL" logcat -c
|
|
adb -s "$SERIAL" shell am start -n "$PKG/dev.iris.android.demo.MainActivity" >/dev/null
|
|
|
|
ui-trace record -s "$SERIAL" -d 3000 --do "tap 'Run benchmark'" -o /tmp/run-bench-tap.txt >/dev/null
|
|
|
|
# Poll for the report line rather than a fixed sleep -- the run itself is
|
|
# a fixed script (RUST.md's "Benchmark v2": 16 flings, a 20s streaming
|
|
# phase, ~61s of typing, 10s of keyboard toggles, roughly 2.5 minutes end
|
|
# to end) but device speed varies. 260s cap rather than v1's 90s -- v2 is
|
|
# a longer script than v1's swipe-loop-only run.
|
|
i=0
|
|
while [ "$i" -lt 260 ]; do
|
|
LINE=$(adb -s "$SERIAL" logcat -d -s iris-android-app:I 2>/dev/null | grep "iris bench report:" || true)
|
|
if [ -n "$LINE" ]; then
|
|
break
|
|
fi
|
|
i=$((i + 1))
|
|
sleep 1
|
|
done
|
|
if [ -z "$LINE" ]; then
|
|
echo "run-bench.sh: no report after 260s -- check logcat by hand" >&2
|
|
exit 1
|
|
fi
|
|
# -A 60 rather than v1's -A 6 -- v2's report has a per-phase block (four
|
|
# phases, four lines each) on top of the frames/bench sections v1 had.
|
|
adb -s "$SERIAL" logcat -d -s iris-android-app:I | grep -A 60 "iris bench report:"
|