Files
skate-3-rust-engine/tools/audio-bench/timing_summary.py
T
Hails 418dcecd41 Audio: interim cue tables retired, native water splash, published tools
- The interim cue tables and their opt-outs are gone; the native runtime is the only audio path. Old
  settings/audio.json files still load ("interim" / "native" ignored). Missing native data logs an error
  instead of falling back.
- Water splash from retail's mechanism (SFXObj_OffBoard start / update): Skate_Collisions 1187 / 1197 once
  per water stay, 1198 when the board is in water.
- The random interim riding bed is removed; riding collision and cloth sounds compared with the recomp
  (doc 11). Native output otherwise byte-identical (13 scenarios + 5 sessions).
- Published tools under tools/ (one folder per tool with a README; the recomp ones labelled for use with the
  research hooks), doc 14 and PR plan bucket L.
- Docs: doc 11 (retirement, bail density measured against the recomp, collision posts), doc 13 (usage guide).
2026-10-03 10:20:08 -06:00

45 lines
1.4 KiB
Python

"""Summarise e2e_bench.sh timing: per run dir, the game-thread call and render-block times pooled
over every scenario (p50 / p90 / p99 / p99.9 / max, µs, and the total), side by side for each
run given.
py -3.13 tools/audio-bench/timing_summary.py RUN_DIR [RUN_DIR...]
"""
import sys
from pathlib import Path
def load(d: Path):
out = {}
for sub in sorted(p for p in d.iterdir() if p.is_dir()):
kinds = {'frame': [], 'block': []}
for f in sub.glob('*.ours.timing.tsv'):
for line in f.read_text().splitlines()[1:]:
k, us = line.split('\t')
kinds[k].append(float(us))
out[sub.name] = kinds
return out
def q(v, p):
return v[min(len(v) - 1, int((len(v) - 1) * p))]
def main():
if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'):
sys.exit(__doc__)
runs = [(Path(a).name, load(Path(a))) for a in sys.argv[1:]]
sets = sorted({s for _, r in runs for s in r})
for s in sets:
for kind in ('block', 'frame'):
print(f'{s} {kind}:')
for name, r in runs:
v = sorted(r.get(s, {}).get(kind, []))
if not v:
continue
print(f' {name:>16}: n {len(v):6d} p50 {q(v, .5):7.1f} p90 {q(v, .9):7.1f} p99 {q(v, .99):7.1f}'
f' p99.9 {q(v, .999):7.1f} max {v[-1]:8.1f} sum {sum(v) / 1e3:9.1f} ms')
if __name__ == '__main__':
main()