#!/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 <dir> # where the trace and lines go# # (default ~/cotton-captures/scroll-perf/<utc stamp>)# scripts/perf/scroll.sh --sim <udid> # measure on this booted simulator# scripts/perf/scroll.sh --report <dir> # 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 pipefailHERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"OUT=""; SIM=""; REPORT_ONLY=""while [ $# -gt 0 ]; docase"$1"in --out) OUT="${2:?--out needs a folder}"; shift2 ;; --sim) SIM="${2:?--sim needs a simulator udid}"; shift2 ;; --report) REPORT_ONLY="${2:?--report needs a run folder}"; shift2 ;; --seconds) export SCROLL_S="${2:?--seconds needs a count}"; shift2 ;; --rows) export SCROLL_ROWS="${2:?--rows needs a count}"; shift2 ;; --tools) export SCROLL_TOOLS="${2:?--tools needs tool keys}"; shift2 ;; *) echo "usage: scroll.sh [--out <dir>] [--sim <udid>] [--report <dir>] [--seconds <n>] [--rows <n>] [--tools <a|b>]" >&2; exit2 ;;esacdoneif [ -n "$REPORT_ONLY" ]; then exec python3 "$HERE/scroll-report.py""$REPORT_ONLY"fiOUT="${OUT:-$HOME/cotton-captures/scroll-perf/$(date -u +%Y%m%dT%H%M%SZ)}"python3 "$HERE/../lib/evidence.py" begin "$OUT" >/dev/nullOUT="$(cd "$OUT" && pwd -P)"bash "$HERE/../ui-tests-stub.sh" --scroll-perf "$OUT" ${SIM:+--fan-sim "$SIM"}exec python3 "$HERE/scroll-report.py""$OUT"