Files
mtusi2026lab3/scripts/baseline.py
T
2026-11-07 10:41:21 +03:00

16 lines
667 B
Python
Executable File

#!/usr/bin/env python3
"""Save repeatable measurements of the legacy token-hash implementation."""
import json,subprocess,time
from pathlib import Path
root=Path(__file__).resolve().parents[1]
def main():
for rate in (5,20,80):
for repeat in range(1,4):
label=f'before-2-r{rate}-n{repeat}'
dest=root/'evidence/research'/f'{label}.json'
if dest.exists():continue
print(label,flush=True)
p=subprocess.run([str(root/'bin/benchmark'),'-rate',str(rate),'-duration','15s','-warmup','3s','-seed','1000','-label',label,'-output',str(dest)],cwd=root,stdout=subprocess.DEVNULL)
if p.returncode:raise SystemExit(p.returncode)
if __name__=='__main__':main()