Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions test/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,12 @@ def get_output_files(self):


# This benchmarker will make a test benchmark build with Emscripten and record
# the file output sizes in out/test/stats.json. The file format is specified at
# the file output sizes and compile time in out/test/stats.json. The file format is specified at
# https://skia.googlesource.com/buildbot/+/refs/heads/main/perf/FORMAT.md
# Running the benchmark will be skipped.
class SizeBenchmarker(EmscriptenBenchmarker):
# Note: This is called SkiaPerfBenchmarker because it outputs results for ingestion into Skia Perf
# monitoring dashboards, not because it benchmarks the Skia graphics library.
class SkiaPerfBenchmarker(EmscriptenBenchmarker):
Comment thread
brendandahl marked this conversation as resolved.
record_stats = True

def __init__(self, name):
Expand Down Expand Up @@ -386,7 +388,9 @@ def get_output_files(self):
named_benchmarkers = {
'clang': NativeBenchmarker('clang', [CLANG_CC], [CLANG_CXX]),
'gcc': NativeBenchmarker('gcc', ['gcc', '-no-pie'], ['g++', '-no-pie']),
'size': SizeBenchmarker('size'),
'skia-perf': SkiaPerfBenchmarker('skia-perf'),
# TODO: remove this once we update emscripten releases to use the new name.
'size': SkiaPerfBenchmarker('size'),
'v8': EmscriptenBenchmarker('v8', aot_v8),
'v8-lto': EmscriptenBenchmarker('v8-lto', aot_v8, ['-flto']),
'v8-ctors': EmscriptenBenchmarker('v8-ctors', aot_v8, ['-sEVAL_CTORS']),
Expand Down Expand Up @@ -489,21 +493,24 @@ def do_benchmark(self, name, src, expected_output='FAIL', args=None,
# If we won't run the benchmark, we don't need repetitions.
reps = 0
print('Running benchmarker: %s: %s' % (b.__class__.__name__, b.name))
t1 = time.time()
b.build(self, filename, shared_args, emcc_args, native_args, native_exec, lib_builder)
build_time = time.time() - t1
b.bench(args, reps, output_parser, expected_output)
recorded_stats = b.display(baseline)
if recorded_stats:
self.add_stats(name, recorded_stats)
self.add_stats(name, [{'value': 'compile_time', 'measurement': build_time}], units='s')
if not baseline:
# Use the first benchmarker as the baseline. Other benchmarkers can then
# report relative performance compared to this.
baseline = b

def add_stats(self, name, stats):
def add_stats(self, name, stats, units='bytes'):
self.stats.append({
'key': {
'test': name,
'units': 'bytes',
'units': units,
},
'measurements': {
'stats': stats,
Expand Down
Loading