#!/bin/bash # Stage 0 — cycle-quantum preemption sweep # # Runs xenia-rs-stage0 in OrderMode::ScanQuantum at quanta # [10, 50, 200, 1000, 5000, 10000] x 3 cold boots, computes the # det-fields MD5 over each JSONL output, and records the matched-prefix # vs the archived canary cold baseline. # # Outputs: # /tmp/stage0/ours-q${ticks}-r${run}.jsonl — raw events # /tmp/stage0/digest-q${ticks}-r${run}.json — det-fields MD5 # audit-runs/stage0-quantum-sweep/diff-q${ticks}.txt — diff_events.py output set -euo pipefail REPO="/home/fabi/RE - Project Sylpheed" ISO="$REPO/Project Sylpheed - Arc of Deception (USA, Europe) (En,Ja).iso" BIN="$REPO/xenia-rs/target/release/xenia-rs-stage0" DET="$REPO/xenia-rs/audit-runs/stage0-quantum-sweep/det_digest.py" DIFF="$REPO/xenia-rs/tools/diff-events/diff_events.py" CANARY_BASELINE="$REPO/xenia-rs/audit-runs/phase-c22-rtl-enter-leave-control-flow/canary-cold-trunc.jsonl" SWEEP_DIR="$REPO/xenia-rs/audit-runs/stage0-quantum-sweep" mkdir -p /tmp/stage0 RESULTS="$SWEEP_DIR/sweep-results.tsv" echo -e "ticks\trun\ttotal_events\tdet_fields_md5" > "$RESULTS" for q in 10 50 200 1000 5000 10000; do for run in 1 2 3; do out="/tmp/stage0/ours-q${q}-r${run}.jsonl" log="/tmp/stage0/ours-q${q}-r${run}.log" digest_file="/tmp/stage0/digest-q${q}-r${run}.json" XENIA_CACHE_WIPE=1 XENIA_SCHED_ORDER=quantum XENIA_SCHED_QUANTUM=$q \ "$BIN" exec --phase-a-event-log "$out" -n 50000000 --quiet "$ISO" \ > "$log" 2>&1 python3 "$DET" "$out" > "$digest_file" events=$(python3 -c "import json; print(json.load(open('$digest_file'))['total_events'])") digest=$(python3 -c "import json; print(json.load(open('$digest_file'))['det_fields_md5'])") echo -e "${q}\t${run}\t${events}\t${digest}" >> "$RESULTS" echo "ticks=${q} run=${run} events=${events} digest=${digest}" done # Diff run-1 vs canary baseline diff_out="$SWEEP_DIR/diff-q${q}.txt" python3 "$DIFF" \ --canary "$CANARY_BASELINE" \ --ours "/tmp/stage0/ours-q${q}-r1.jsonl" \ --tid-map 6=1,7=2,4=11,12=7,14=9,15=10 \ > "$diff_out" 2>&1 || true done cat "$RESULTS"