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 { ...@@ -228,6 +228,7 @@ class CompileTest {
final List<String> options = <String>[ final List<String> options = <String>[
'aot', 'aot',
'-v', '-v',
'--extra-gen-snapshot-options=--print_snapshot_sizes',
'--release', '--release',
'--no-pub', '--no-pub',
'--target-platform', '--target-platform',
...@@ -253,6 +254,9 @@ class CompileTest { ...@@ -253,6 +254,9 @@ class CompileTest {
for (Match m in metricExpression.allMatches(compileLog)) { for (Match m in metricExpression.allMatches(compileLog)) {
metrics[_sdkNameToMetricName(m.group(1))] = int.parse(m.group(2)); 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; metrics['aot_snapshot_compile_millis'] = watch.elapsedMilliseconds;
return metrics; return metrics;
...@@ -326,8 +330,7 @@ class CompileTest { ...@@ -326,8 +330,7 @@ class CompileTest {
}; };
} }
static String _sdkNameToMetricName(String sdkName) { static const Map<String, String> _kSdkNameToMetricNameMapping = const <String, String> {
const Map<String, String> kSdkNameToMetricNameMapping = const <String, String> {
'VMIsolate': 'aot_snapshot_size_vmisolate', 'VMIsolate': 'aot_snapshot_size_vmisolate',
'Isolate': 'aot_snapshot_size_isolate', 'Isolate': 'aot_snapshot_size_isolate',
'ReadOnlyData': 'aot_snapshot_size_rodata', 'ReadOnlyData': 'aot_snapshot_size_rodata',
...@@ -335,10 +338,12 @@ class CompileTest { ...@@ -335,10 +338,12 @@ class CompileTest {
'Total': 'aot_snapshot_size_total', 'Total': 'aot_snapshot_size_total',
}; };
if (!kSdkNameToMetricNameMapping.containsKey(sdkName)) static String _sdkNameToMetricName(String sdkName) {
if (!_kSdkNameToMetricNameMapping.containsKey(sdkName))
throw 'Unrecognized SDK snapshot metric name: $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