#!/usr/bin/env bash # Lists flung under the fan, traced on a ProMotion simulator (291 row F: "120 # Hz with no dropped frames scrolling any list while the fan folds and # blooms"). Builds the synthetic Home with Meetings, Mood, People and Email # grown to a couple of hundred invented rows each (`-list-rows`), turns the # fan to each tool's tile and flings its list down and up for ten seconds, so # the fan folds and blooms over a list in flight, and records it with xctrace # and the app's own frame meter. Prints one row a tool: Core Animation # commits over one 120 Hz frame (8.3 ms) per 10 s, the longest and the p99 # commit, the frame meter's late frames per 10 s and its worst frame, the # folds and blooms the fan logged, and the app's hottest code while flinging. # The target is zero commits over a frame; any is a finding. Exits 1 when # there is one, or when a tool's flings never folded the fan. # # scripts/perf/scroll.sh # build, measure, report # scripts/perf/scroll.sh --out # where the trace and lines go # # (default ~/cotton-captures/scroll-perf/) # scripts/perf/scroll.sh --sim # measure on this booted simulator # scripts/perf/scroll.sh --report # report a finished run again, no build # scripts/perf/scroll.sh --seconds 10 # each list's flinging (default 10) # scripts/perf/scroll.sh --rows 200 # invented rows added to each list (default 200) # scripts/perf/scroll.sh --tools 'mood|email' # the tools flung, by tool key, in order # # Measure the same way before and after a change and compare the two tables: # the simulator's compositor is not the phone's, so a figure here is read # against another figure here, never against a phone's. # # Synthetic data only: the preview app runs over bundled fixture records, # invented rows made from them and a scripted core, never a household or the # owner's data. set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" OUT=""; SIM=""; REPORT_ONLY="" while [ $# -gt 0 ]; do case "$1" in --out) OUT="${2:?--out needs a folder}"; shift 2 ;; --sim) SIM="${2:?--sim needs a simulator udid}"; shift 2 ;; --report) REPORT_ONLY="${2:?--report needs a run folder}"; shift 2 ;; --seconds) export SCROLL_S="${2:?--seconds needs a count}"; shift 2 ;; --rows) export SCROLL_ROWS="${2:?--rows needs a count}"; shift 2 ;; --tools) export SCROLL_TOOLS="${2:?--tools needs tool keys}"; shift 2 ;; *) echo "usage: scroll.sh [--out ] [--sim ] [--report ] [--seconds ] [--rows ] [--tools ]" >&2; exit 2 ;; esac done if [ -n "$REPORT_ONLY" ]; then exec python3 "$HERE/scroll-report.py" "$REPORT_ONLY" fi OUT="${OUT:-$HOME/cotton-captures/scroll-perf/$(date -u +%Y%m%dT%H%M%SZ)}" python3 "$HERE/../lib/evidence.py" begin "$OUT" >/dev/null OUT="$(cd "$OUT" && pwd -P)" bash "$HERE/../ui-tests-stub.sh" --scroll-perf "$OUT" ${SIM:+--fan-sim "$SIM"} exec python3 "$HERE/scroll-report.py" "$OUT"