From e9e8ca764069dd7a3b479f67889d6971e27cbe1a Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 5 Mar 2021 15:33:28 -0800 Subject: [PATCH] Add debug_second_compile_millis benchmark metric (#77420) --- dev/devicelab/lib/tasks/perf_tests.dart | 27 ++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/dev/devicelab/lib/tasks/perf_tests.dart b/dev/devicelab/lib/tasks/perf_tests.dart index e0092a44cf..4837a72a55 100644 --- a/dev/devicelab/lib/tasks/perf_tests.dart +++ b/dev/devicelab/lib/tasks/perf_tests.dart @@ -1000,9 +1000,21 @@ class CompileTest { await device.unlock(); await flutter('packages', options: ['get']); + final Map compileRelease = await _compileApp(reportPackageContentSizes: reportPackageContentSizes); + final Map compileDebug = await _compileDebug( + clean: true, + metricKey: 'debug_full_compile_millis', + ); + // Build again without cleaning, should be faster. + final Map compileSecondDebug = await _compileDebug( + clean: false, + metricKey: 'debug_second_compile_millis', + ); + final Map metrics = { - ...await _compileApp(reportPackageContentSizes: reportPackageContentSizes), - ...await _compileDebug(), + ...compileRelease, + ...compileDebug, + ...compileSecondDebug, }; return TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList()); @@ -1082,8 +1094,13 @@ class CompileTest { return metrics; } - static Future> _compileDebug() async { - await flutter('clean'); + static Future> _compileDebug({ + @required bool clean, + @required String metricKey, + }) async { + if (clean) { + await flutter('clean'); + } final Stopwatch watch = Stopwatch(); final List options = ['--debug']; switch (deviceOperatingSystem) { @@ -1109,7 +1126,7 @@ class CompileTest { watch.stop(); return { - 'debug_full_compile_millis': watch.elapsedMilliseconds, + metricKey: watch.elapsedMilliseconds, }; }