From 8b9eb3e2b20189c188b2c300813ce248a606d282 Mon Sep 17 00:00:00 2001 From: Jonas Termansen Date: Thu, 2 May 2019 15:22:43 +0200 Subject: [PATCH] Report CompileTime metric in flutter build aot --report-timings. (#31895) This is the correct metric to report for compilation time benchmarks rather than RunTime. Rename the 'gen_snapshot' value to merely 'snapshot' for backwards compatibility and overall simplicity. This change simplifies Dart's benchmarking of Flutter by making it easier to adopt --report-timings (made for Dart to use), which makes the benchmarks much more robust. --- packages/flutter_tools/lib/src/base/build.dart | 6 +++--- packages/flutter_tools/test/base/build_test.dart | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart index 4f11a5468a..d1bc9787cb 100644 --- a/packages/flutter_tools/lib/src/base/build.dart +++ b/packages/flutter_tools/lib/src/base/build.dart @@ -203,7 +203,7 @@ class AOTSnapshotter { // } final SnapshotType snapshotType = SnapshotType(platform, buildMode); - final int genSnapshotExitCode = await _timedStep('gen_snapshot', () => genSnapshot.run( + final int genSnapshotExitCode = await _timedStep('snapshot(CompileTime)', () => genSnapshot.run( snapshotType: snapshotType, additionalArgs: genSnapshotArgs, iosArch: iosArch, @@ -315,7 +315,7 @@ class AOTSnapshotter { final String depfilePath = fs.path.join(outputPath, 'kernel_compile.d'); final KernelCompiler kernelCompiler = await kernelCompilerFactory.create(flutterProject); - final CompilerOutput compilerOutput = await _timedStep('frontend', () => kernelCompiler.compile( + final CompilerOutput compilerOutput = await _timedStep('frontend(CompileTime)', () => kernelCompiler.compile( sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode), mainPath: mainPath, packagesPath: packagesPath, @@ -361,7 +361,7 @@ class AOTSnapshotter { final Stopwatch sw = Stopwatch()..start(); final T value = await action(); if (reportTimings) { - printStatus('$marker(RunTime): ${sw.elapsedMilliseconds} ms.'); + printStatus('$marker: ${sw.elapsedMilliseconds} ms.'); } return value; } diff --git a/packages/flutter_tools/test/base/build_test.dart b/packages/flutter_tools/test/base/build_test.dart index 4fdd298044..3d2ca53f01 100644 --- a/packages/flutter_tools/test/base/build_test.dart +++ b/packages/flutter_tools/test/base/build_test.dart @@ -525,7 +525,7 @@ void main() { expect(genSnapshotExitCode, 0); expect(genSnapshot.callCount, 1); - expect(bufferLogger.statusText, matches(RegExp(r'gen_snapshot\(RunTime\): \d+ ms.'))); + expect(bufferLogger.statusText, matches(RegExp(r'snapshot\(CompileTime\): \d+ ms.'))); }, overrides: contextOverrides); });