track debug build times; switch from --profile to --release
This commit is contained in:
parent
307f3569a2
commit
f59a67707d
@ -177,6 +177,8 @@ class PerfTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Measures how long it takes to build a Flutter app and how big the compiled
|
||||||
|
/// code is.
|
||||||
class BuildTest {
|
class BuildTest {
|
||||||
|
|
||||||
BuildTest(this.testDirectory);
|
BuildTest(this.testDirectory);
|
||||||
@ -189,29 +191,60 @@ class BuildTest {
|
|||||||
await device.unlock();
|
await device.unlock();
|
||||||
await flutter('packages', options: <String>['get']);
|
await flutter('packages', options: <String>['get']);
|
||||||
|
|
||||||
final Stopwatch watch = new Stopwatch()..start();
|
final Map<String, dynamic> aotResults = await _buildAot();
|
||||||
final String buildLog = await evalFlutter('build', options: <String>[
|
final Map<String, dynamic> debugResults = await _buildDebug();
|
||||||
'aot',
|
|
||||||
'-v',
|
|
||||||
'--profile',
|
|
||||||
'--no-pub',
|
|
||||||
'--target-platform', 'android-arm' // Generate blobs instead of assembly.
|
|
||||||
]);
|
|
||||||
watch.stop();
|
|
||||||
|
|
||||||
final RegExp metricExpression = new RegExp(r'([a-zA-Z]+)\(CodeSize\)\: (\d+)');
|
final Map<String, dynamic> metrics = <String, dynamic>{}
|
||||||
|
..addAll(aotResults)
|
||||||
|
..addAll(debugResults);
|
||||||
|
|
||||||
final Map<String, dynamic> data = new Map<String, dynamic>.fromIterable(
|
return new TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
|
||||||
metricExpression.allMatches(buildLog),
|
|
||||||
key: (Match m) => _sdkNameToMetricName(m.group(1)),
|
|
||||||
value: (Match m) => int.parse(m.group(2)),
|
|
||||||
);
|
|
||||||
data['aot_snapshot_build_millis'] = watch.elapsedMilliseconds;
|
|
||||||
|
|
||||||
return new TaskResult.success(data, benchmarkScoreKeys: data.keys.toList());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<Map<String, dynamic>> _buildAot() async {
|
||||||
|
await flutter('build', options: <String>['clean']);
|
||||||
|
final Stopwatch watch = new Stopwatch()..start();
|
||||||
|
final String buildLog = await evalFlutter('build', options: <String>[
|
||||||
|
'aot',
|
||||||
|
'-v',
|
||||||
|
'--release',
|
||||||
|
'--no-pub',
|
||||||
|
'--target-platform', 'android-arm' // Generate blobs instead of assembly.
|
||||||
|
]);
|
||||||
|
watch.stop();
|
||||||
|
|
||||||
|
final RegExp metricExpression = new RegExp(r'([a-zA-Z]+)\(CodeSize\)\: (\d+)');
|
||||||
|
final Map<String, dynamic> metrics = new Map<String, dynamic>.fromIterable(
|
||||||
|
metricExpression.allMatches(buildLog),
|
||||||
|
key: (Match m) => _sdkNameToMetricName(m.group(1)),
|
||||||
|
value: (Match m) => int.parse(m.group(2)),
|
||||||
|
);
|
||||||
|
metrics['aot_snapshot_build_millis'] = watch.elapsedMilliseconds;
|
||||||
|
|
||||||
|
return metrics;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Map<String, dynamic>> _buildDebug() async {
|
||||||
|
await flutter('build', options: <String>['clean']);
|
||||||
|
|
||||||
|
final Stopwatch watch = new Stopwatch();
|
||||||
|
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
|
||||||
|
await prepareProvisioningCertificates(cwd);
|
||||||
|
watch.start();
|
||||||
|
await flutter('build', options: <String>['ios', '--debug']);
|
||||||
|
watch.stop();
|
||||||
|
} else {
|
||||||
|
watch.start();
|
||||||
|
await flutter('build', options: <String>['apk', '--debug']);
|
||||||
|
watch.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
return <String, dynamic>{
|
||||||
|
'debug_full_build_millis': watch.elapsedMilliseconds,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static String _sdkNameToMetricName(String sdkName) {
|
static String _sdkNameToMetricName(String sdkName) {
|
||||||
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',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user