initial commit
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Repeat the existing ten-condition workload for the current production build."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def sha(path):
|
||||
with path.open('rb') as stream:
|
||||
return hashlib.file_digest(stream, 'sha256').hexdigest()
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--output', type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
out = args.output.resolve(); out.mkdir(parents=True, exist_ok=False)
|
||||
(out / 'runner-at-start.py').write_bytes(Path(__file__).read_bytes())
|
||||
env = dict(os.environ)
|
||||
for name in ('DISPLAY', 'WAYLAND_DISPLAY', 'QT_SCREEN_SCALE_FACTORS', 'QT_STYLE_OVERRIDE', 'QT_SCALE_FACTOR_ROUNDING_POLICY'):
|
||||
env.pop(name, None)
|
||||
env.update(QT_QPA_PLATFORM='xcb', QT_QUICK_BACKEND='software', QTWEBENGINE_CHROMIUM_FLAGS='--disable-gpu',
|
||||
QT_SCALE_FACTOR='1', QT_FONT_DPI='96', QT_AUTO_SCREEN_SCALE_FACTOR='0')
|
||||
record = {'success': False, 'scope': 'Arch Xvfb 1100x760 DPR1/software; OS file cache retained; development measurements, not reference hardware acceptance',
|
||||
'binaries': {name: sha(ROOT / 'build' / name) for name in ('docview', 'docview-pdf-worker', 'docview-archive-worker', 'test_app')},
|
||||
'runnerSha256': sha(Path(__file__)), 'commands': [],
|
||||
'displayEnvironment': {name: env[name] for name in ('QT_QPA_PLATFORM', 'QT_QUICK_BACKEND', 'QTWEBENGINE_CHROMIUM_FLAGS', 'QT_SCALE_FACTOR', 'QT_FONT_DPI', 'QT_AUTO_SCREEN_SCALE_FACTOR')}}
|
||||
jobs = [(corpus, ['python3', 'tests/benchmark.py', '--binary', 'build/docview', '--corpus', corpus,
|
||||
'--operations', '125', '--cold-process-runs', '30', '--output', str(out / corpus)])
|
||||
for corpus in ('smoke', 'standard', 'fonts')]
|
||||
jobs += [('interaction', ['python3', 'tests/measure_interaction.py', '--binary', 'build/test_app', '--output', str(out / 'interaction')]),
|
||||
('stress', ['python3', 'tests/run_stress_pdf.py', '--binary', 'build/docview', '--output', str(out / 'stress')])]
|
||||
try:
|
||||
for name, command in jobs:
|
||||
wrapper = ['dbus-run-session', '--', 'xvfb-run', '-a', '-s', '-screen 0 1100x760x24 -dpi 96 -nolisten tcp']
|
||||
started = time.monotonic()
|
||||
with (out / (name + '.log')).open('w') as log:
|
||||
result = subprocess.run(wrapper + command, cwd=ROOT, env=env, stdout=log, stderr=subprocess.STDOUT, timeout=1500)
|
||||
row = {'name': name, 'command': wrapper + command, 'exitCode': result.returncode, 'seconds': time.monotonic() - started,
|
||||
'measurementRunnerSha256': sha(ROOT / command[1])}
|
||||
record['commands'].append(row)
|
||||
(out / 'progress.json').write_text(json.dumps(record, indent=2) + '\n')
|
||||
print(json.dumps(row), flush=True)
|
||||
if result.returncode: raise RuntimeError('Failed workload: ' + name)
|
||||
assert all(sha(ROOT / 'build' / name) == digest for name, digest in record['binaries'].items())
|
||||
record['success'] = True
|
||||
finally:
|
||||
(out / 'report.json').write_text(json.dumps(record, indent=2) + '\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user