diff --git a/dev/benchmarks/microbenchmarks/lib/stocks/build_bench.dart b/dev/benchmarks/microbenchmarks/lib/stocks/build_bench.dart index 3b9a782c02..dfde886a32 100644 --- a/dev/benchmarks/microbenchmarks/lib/stocks/build_bench.dart +++ b/dev/benchmarks/microbenchmarks/lib/stocks/build_bench.dart @@ -44,7 +44,11 @@ Future main() async { // artificially high load to find out how much CPU each frame takes. // This differs from normal benchmarks which might look at how many // frames are missed, etc. - ui.window.onBeginFrame(new Duration(milliseconds: iterations * 16)); + // We use Timer.run to ensure there's a microtask flush in between + // the two calls below. + Timer.run(() { ui.window.onBeginFrame(new Duration(milliseconds: iterations * 16)); }); + Timer.run(() { ui.window.onDrawFrame(); }); + await tester.idle(); // wait until the frame has run iterations += 1; } watch.stop(); diff --git a/dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart b/dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart index f402e4006f..933ff41429 100644 --- a/dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart +++ b/dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart @@ -45,7 +45,11 @@ Future main() async { // artificially high load to find out how much CPU each frame takes. // This differs from normal benchmarks which might look at how many // frames are missed, etc. - ui.window.onBeginFrame(new Duration(milliseconds: iterations * 16)); + // We use Timer.run to ensure there's a microtask flush in between + // the two calls below. + Timer.run(() { ui.window.onBeginFrame(new Duration(milliseconds: iterations * 16)); }); + Timer.run(() { ui.window.onDrawFrame(); }); + await tester.idle(); // wait until the frame has run iterations += 1; } watch.stop(); diff --git a/dev/devicelab/lib/tasks/microbenchmarks.dart b/dev/devicelab/lib/tasks/microbenchmarks.dart index b7e82b1a4a..a3844145a3 100644 --- a/dev/devicelab/lib/tasks/microbenchmarks.dart +++ b/dev/devicelab/lib/tasks/microbenchmarks.dart @@ -29,9 +29,8 @@ TaskFunction createMicrobenchmarkTask() { final Directory appDir = dir( path.join(flutterDirectory.path, 'dev/benchmarks/microbenchmarks')); final Process flutterProcess = await inDirectory(appDir, () async { - if (deviceOperatingSystem == DeviceOperatingSystem.ios) { + if (deviceOperatingSystem == DeviceOperatingSystem.ios) await prepareProvisioningCertificates(appDir.path); - } return await _startFlutter( options: [ '--profile',