Files
leaguerecorder/app/vendor/rune/scripts/bench-live.py
T
vhaudiquet 5bf262b82b app: cherry-pick rune's pause and sound fixes onto the checkout
Rune comes from app/vendor/rune now, a checkout of 63ad0209 on branch
ported, carrying the four commits of upstream issues 1320 (a pause while
a clip is layered holds the layer's picture and time) and 1325 (a video's
sound is read ahead of the clock and leads it). Both were written against
eb9f1104 and ported across the refactors since. The faults are the first
two and the third in docs/rune-upstream.md; the app's workarounds in
review.rs stay until the fixes arrive upstream.
2026-11-22 22:16:30 +01:00

35 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""CPU submission benchmark for 16 × 60 Hz meters + 4 × 120 Hz cursors; no window."""
import argparse
import json
import re
import statistics
import subprocess
from perf_binary import perf_binary
p = argparse.ArgumentParser()
p.add_argument('--binary', default='target/perf/live-values')
p.add_argument('--baseline', action='store_true')
a = p.parse_args()
a.binary = str(perf_binary(a.binary))
modes = ['rebuild'] if a.baseline else ['rebuild', 'live']
samples = {mode: [] for mode in modes}
for run in range(8):
# Alternate order so driver load and temperature cannot systematically favour a mode.
for mode in modes[::(-1 if run % 2 else 1)]:
cmd = [a.binary, '--frames', '480', '--fps', '120']
if mode == 'rebuild':
cmd.append('--rebuild')
output = subprocess.run(cmd, check=True, capture_output=True, text=True).stderr
match = re.search(r'frame cpu mean ([\d.]+) ms p50 ([\d.]+) p95 ([\d.]+)', output)
if not match:
raise RuntimeError(output)
if run:
samples[mode].append(dict(zip(['mean_ms', 'p50_ms', 'p95_ms'], map(float, match.groups()))))
results = {}
for mode, runs in samples.items():
results[mode] = {k: statistics.median(r[k] for r in runs) for k in runs[0]}
results[mode]['runs'] = runs
print(json.dumps(results, indent=2))