Unverified Commit 2a19dae2 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Fix aot_snapshot_size_* benchmarks (#18520)

... and make sure they fail if they can't report the size.
parent 0fa5ba43
......@@ -228,6 +228,7 @@ class CompileTest {
final List<String> options = <String>[
'aot',
'-v',
'--extra-gen-snapshot-options=--print_snapshot_sizes',
'--release',
'--no-pub',
'--target-platform',
......@@ -253,6 +254,9 @@ class CompileTest {
for (Match m in metricExpression.allMatches(compileLog)) {
metrics[_sdkNameToMetricName(m.group(1))] = int.parse(m.group(2));
}
if (metrics.length != _kSdkNameToMetricNameMapping.length) {
throw 'Expected metrics: ${_kSdkNameToMetricNameMapping.keys}, but got: ${metrics.keys}.';
}
metrics['aot_snapshot_compile_millis'] = watch.elapsedMilliseconds;
return metrics;
......@@ -326,19 +330,20 @@ class CompileTest {
};
}
static const Map<String, String> _kSdkNameToMetricNameMapping = const <String, String> {
'VMIsolate': 'aot_snapshot_size_vmisolate',
'Isolate': 'aot_snapshot_size_isolate',
'ReadOnlyData': 'aot_snapshot_size_rodata',
'Instructions': 'aot_snapshot_size_instructions',
'Total': 'aot_snapshot_size_total',
};
static String _sdkNameToMetricName(String sdkName) {
const Map<String, String> kSdkNameToMetricNameMapping = const <String, String> {
'VMIsolate': 'aot_snapshot_size_vmisolate',
'Isolate': 'aot_snapshot_size_isolate',
'ReadOnlyData': 'aot_snapshot_size_rodata',
'Instructions': 'aot_snapshot_size_instructions',
'Total': 'aot_snapshot_size_total',
};
if (!kSdkNameToMetricNameMapping.containsKey(sdkName))
if (!_kSdkNameToMetricNameMapping.containsKey(sdkName))
throw 'Unrecognized SDK snapshot metric name: $sdkName';
return kSdkNameToMetricNameMapping[sdkName];
return _kSdkNameToMetricNameMapping[sdkName];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment