Commit 2b04e300 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Fix microbenchmarks tests. (#9782)

parent 961da5a3
...@@ -44,7 +44,11 @@ Future<Null> main() async { ...@@ -44,7 +44,11 @@ Future<Null> main() async {
// artificially high load to find out how much CPU each frame takes. // artificially high load to find out how much CPU each frame takes.
// This differs from normal benchmarks which might look at how many // This differs from normal benchmarks which might look at how many
// frames are missed, etc. // 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; iterations += 1;
} }
watch.stop(); watch.stop();
......
...@@ -45,7 +45,11 @@ Future<Null> main() async { ...@@ -45,7 +45,11 @@ Future<Null> main() async {
// artificially high load to find out how much CPU each frame takes. // artificially high load to find out how much CPU each frame takes.
// This differs from normal benchmarks which might look at how many // This differs from normal benchmarks which might look at how many
// frames are missed, etc. // 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; iterations += 1;
} }
watch.stop(); watch.stop();
......
...@@ -29,9 +29,8 @@ TaskFunction createMicrobenchmarkTask() { ...@@ -29,9 +29,8 @@ TaskFunction createMicrobenchmarkTask() {
final Directory appDir = dir( final Directory appDir = dir(
path.join(flutterDirectory.path, 'dev/benchmarks/microbenchmarks')); path.join(flutterDirectory.path, 'dev/benchmarks/microbenchmarks'));
final Process flutterProcess = await inDirectory(appDir, () async { final Process flutterProcess = await inDirectory(appDir, () async {
if (deviceOperatingSystem == DeviceOperatingSystem.ios) { if (deviceOperatingSystem == DeviceOperatingSystem.ios)
await prepareProvisioningCertificates(appDir.path); await prepareProvisioningCertificates(appDir.path);
}
return await _startFlutter( return await _startFlutter(
options: <String>[ options: <String>[
'--profile', '--profile',
......
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