#!/usr/bin/env bash# The fan's budgets, traced on a ProMotion simulator (fanperf, owner 15 Oct# 2026: "the animations must never make the app heavy; prove it, keep it# proven"). Builds the synthetic Home with 30 tiles, drives the fan with real# swipes (XCUITest), records it with xctrace, and prints one table: frame# times while turning, CPU and Core Animation commits at rest, page-picture# memory and growth over 100 turns, energy over a minute of swiping, cold# start to the fan's first frame. Exits 1 when a figure is over its budget.## scripts/perf/fan.sh # build, measure, report# scripts/perf/fan.sh --out <dir> # where the trace and samples go# # (default ~/cotton-captures/fan-perf/<utc stamp>)# scripts/perf/fan.sh --sim <udid> # measure on this booted simulator# scripts/perf/fan.sh --report <dir> # report a finished run again, no build# scripts/perf/fan.sh --turns 300 # the growth phase's turns (default 100)## Growth is not one run's figure: scripts/perf/growth.py reads a set of runs# (five at 100 turns and one at 300, per runtime and value set) and is the# growth budget (architect, 15 Oct 2026).## Synthetic data only: the preview app runs over bundled fixture records 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 ;; --turns) export FAN_TURNS="${2:?--turns needs a count}"; shift2 ;; *) echo "usage: fan.sh [--out <dir>] [--sim <udid>] [--report <dir>] [--turns <n>]" >&2; exit2 ;;esacdoneif [ -n "$REPORT_ONLY" ]; then exec python3 "$HERE/report.py""$REPORT_ONLY"fiOUT="${OUT:-$HOME/cotton-captures/fan-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" --fan-perf "$OUT" ${SIM:+--fan-sim "$SIM"}exec python3 "$HERE/report.py""$OUT"