Skip to content

Conversation

@liyuqian
Copy link
Contributor

@liyuqian liyuqian commented Apr 8, 2019

Description

Print actionable warnings if flutter drive (where most of our performance benchmarks come from) is run in debug mode and it tries to gather benchmarks using traceAction.

Related Issues

#30625

Tests

I added the following tests:

  • drive_perf_debug_warning devicelab test

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@jonahwilliams
Copy link
Contributor

flutter drive is also used for integration tests, not just benchmarks. It seems like this is going to be a lot of extra noise in that case

@liyuqian liyuqian force-pushed the drive_debug_warning branch from f133659 to 3e3f7c8 Compare April 8, 2019 22:48
@Hixie
Copy link
Contributor

Hixie commented Apr 8, 2019

We should only show this for benchmarks.

FWIW, here's the code for flutter_test that does the equivalent:
https://github.com/flutter/flutter/blob/master/packages/flutter_test/lib/src/widget_tester.dart#L156

Important things to notice:

  • it only runs for benchmarks
  • it only shows the message if the benchmark is run in debug mode
  • the message is pretty and uses fancy Unicode

@dnfield dnfield added a: tests "flutter test", flutter_test, or one of our tests t: flutter driver "flutter driver", flutter_drive, or a driver test labels Apr 9, 2019
Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

liyuqian added 2 commits April 8, 2019 22:13
This test will also make sure that the VM flags are working as intended.
(Previously, `getVmFlags` is unused in our repo and will throw exception
upon calling.)
@liyuqian
Copy link
Contributor Author

liyuqian commented Apr 9, 2019

@Hixie @jonahwilliams : how about the new version which only prints warning if traceAction is called during flutter drive. I've added a devicelab test to test both this warning, and the previously unused getVmFlags function.

Future<List<Map<String, dynamic>>> getVmFlags() async {
final Map<String, dynamic> result = await _peer.sendRequest('getFlagList');
return result['flags'];
return result != null ? result['flags'].cast<Map<String,dynamic>>() : <Map<String, dynamic>>[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the fallback be const?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Done.

}) async {
if (!retainPriorEvents) {
await clearTimeline();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the documentation here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

'Could not find the following warning message piece: $warningPiece'
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should also test the reverse (that running with --profile doesn't show the warning).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Hixie
Copy link
Contributor

Hixie commented Apr 9, 2019

Approach seems reasonable.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@liyuqian liyuqian merged commit eb30745 into flutter:master Apr 10, 2019
@liyuqian liyuqian deleted the drive_debug_warning branch April 12, 2019 22:45
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: tests "flutter test", flutter_test, or one of our tests t: flutter driver "flutter driver", flutter_drive, or a driver test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants