Commit 8b9eb3e2 authored by Jonas Termansen's avatar Jonas Termansen Committed by Vyacheslav Egorov

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.
parent b702d5a3
...@@ -203,7 +203,7 @@ class AOTSnapshotter { ...@@ -203,7 +203,7 @@ class AOTSnapshotter {
// } // }
final SnapshotType snapshotType = SnapshotType(platform, buildMode); 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, snapshotType: snapshotType,
additionalArgs: genSnapshotArgs, additionalArgs: genSnapshotArgs,
iosArch: iosArch, iosArch: iosArch,
...@@ -315,7 +315,7 @@ class AOTSnapshotter { ...@@ -315,7 +315,7 @@ class AOTSnapshotter {
final String depfilePath = fs.path.join(outputPath, 'kernel_compile.d'); final String depfilePath = fs.path.join(outputPath, 'kernel_compile.d');
final KernelCompiler kernelCompiler = await kernelCompilerFactory.create(flutterProject); 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), sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath, mode: buildMode),
mainPath: mainPath, mainPath: mainPath,
packagesPath: packagesPath, packagesPath: packagesPath,
...@@ -361,7 +361,7 @@ class AOTSnapshotter { ...@@ -361,7 +361,7 @@ class AOTSnapshotter {
final Stopwatch sw = Stopwatch()..start(); final Stopwatch sw = Stopwatch()..start();
final T value = await action(); final T value = await action();
if (reportTimings) { if (reportTimings) {
printStatus('$marker(RunTime): ${sw.elapsedMilliseconds} ms.'); printStatus('$marker: ${sw.elapsedMilliseconds} ms.');
} }
return value; return value;
} }
......
...@@ -525,7 +525,7 @@ void main() { ...@@ -525,7 +525,7 @@ void main() {
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(genSnapshot.callCount, 1); 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); }, overrides: contextOverrides);
}); });
......
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