Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

liyuqian
Copy link
Contributor

@liyuqian liyuqian commented Dec 18, 2019

This will start to collect engine benchmarks in the flutter-cirrus
Datastore for all post-submit commits.

We're using this to test how https://github.com/liyuqian/metrics_center
works. Once it's stablized, we should move metrics_center into
flutter/packages, and migrate data to flutter-infra Datastore.

Related issue: flutter/flutter#37434

@auto-assign auto-assign bot requested a review from cbracken December 18, 2019 18:55
@liyuqian liyuqian force-pushed the benchmark branch 12 times, most recently from b64b1f8 to 31b2369 Compare December 19, 2019 00:27
@liyuqian liyuqian changed the title [wip] Run and collect benchmarks Run and collect benchmarks Dec 19, 2019
@liyuqian
Copy link
Contributor Author

@cbracken @godofredoc @digiter @keyonghan : I hope that we can start collecting benchmarks for flutter/engine before the end of 2019 :)

@liyuqian
Copy link
Contributor Author

@goderbauer @digiter @keyonghan : I uploaded this first for review because I want this to test https://github.com/liyuqian/metrics_center first. After the testing is satisfied, I'll ask you to review https://github.com/liyuqian/metrics_center , and either merge it into cocoon or flutter/packages.

@liyuqian liyuqian force-pushed the benchmark branch 2 times, most recently from 57729b8 to 34843b4 Compare December 19, 2019 23:43
if (logResult.exitCode != 0) {
throw 'Unexpected exit code ${logResult.exitCode}';
}
final String gitRevision = logResult.stdout.toString();
Copy link

Choose a reason for hiding this comment

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

Nit: encapsulate the logic of getting git revision into a sub function.

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.

const String kNameKey = 'name';
const String kTimeUnitKey = 'time_unit';

const List<String> kSkippedSubResults = <String>[
Copy link

Choose a reason for hiding this comment

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

Why skip these sub results?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are not the numerical values of metrics. Renamed kSkippedSubResults to kNonNumericalValueSubResults for clarity.

);
}
}
}
Copy link

Choose a reason for hiding this comment

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

Nit: I would also put parsing an item into a sub function.

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.

}

Future<void> main(List<String> args) async {
if (args.length != 1) {
Copy link

Choose a reason for hiding this comment

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

Consider using ArgParser()..addFlag, https://dart.dev/tutorials/server/cmdline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe addFlag is only for boolean, and I didn't use addOption because I think a simple positional argument is better than a named option here. Also, I didn't find a way to make an option as required using args package... Overall, I found args package to bring more overhead than convenience in this case.

@@ -0,0 +1,84 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

2019?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The engine repo enforces 2013 through the license check script.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see.


const String kNameKey = 'name';
const String kTimeUnitKey = 'time_unit';

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: remove empty line.

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.


final List<FlutterEngineMetricPoint> points = <FlutterEngineMetricPoint>[];
for (Map<String, dynamic> item in jsonResult['benchmarks']) {
final String name = item[kNameKey];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: remove empty lines between variables, and add one before the for loop?

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.

if (args.length != 1) {
throw 'Must have one argument: <benchmark_json_file>';
}
final List<FlutterEngineMetricPoint> points = await _parse(args[0]);
Copy link
Contributor

@keyonghan keyonghan Dec 21, 2019

Choose a reason for hiding this comment

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

One check to make sure the file(args[0]) exists before moving forward?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current code generates the following error when the file does not exist:

Unhandled exception:
FileSystemException: Cannot open file, path = 'test.json' (OS Error: No such file or directory, errno = 2)

Does that look good?

throw 'Must have one argument: <benchmark_json_file>';
}
final List<FlutterEngineMetricPoint> points = await _parse(args[0]);
final FlutterDestination destination =
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe good to document which DB this link points to.

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.

@@ -0,0 +1,20 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

same here. 2019?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same enforcement of 2013 unfortunately...

Copy link

@digiter digiter left a comment

Choose a reason for hiding this comment

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

It's unclear to me where and how the data is stored, FlutterDestination seems to define the details.

metrics_center:
# TODO(liyuqian): once metrics_center is properly reviewed, add it to
# flutter/packages, publish on pub.dev, and use the published package here.
git: https://github.com/liyuqian/metrics_center.git
Copy link

Choose a reason for hiding this comment

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

What does metrics center do and why not integrating parse_and_send.dart into metrics center?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Metric center is mainly responsible for extract, transform, and load from some metric database (e.g., cocoon) to some other metric database (e.g., skiaperf). Metric center is itself a database so a client (the engine repo) can directly write metrics into it.

In this case, I intended to only put the client code/logic in the engine repo. That said, I should probably put the transform code (_parse) in the metric center repo, so if some future client also needs to transform https://github.com/google/benchmark results, it doesn't have to rewrite the code.

Thanks for the suggestion!

void main() {
test('parse_and_send with example json does not crash.', () async {
final String testCred =
File('secret/test_gcp_credentials.json').readAsStringSync();
Copy link

Choose a reason for hiding this comment

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

This "secret" directory is git-ignored, then how could another one run this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One should download a service account credentials json from a test GCP project, and put that json as secret/test_gcp_credentials.json. There's a flutter-test project for Flutter team members. I'll add this instruction to the code.

Copy link
Contributor Author

@liyuqian liyuqian left a comment

Choose a reason for hiding this comment

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

@digiter @keyonghan : thank you for the comments! I've revised the PR according to your suggestions in 7177ad7, and then move the Google benchmark parse logic to metrics center in 2c5968d and liyuqian/metrics_center@af57eb0

if (logResult.exitCode != 0) {
throw 'Unexpected exit code ${logResult.exitCode}';
}
final String gitRevision = logResult.stdout.toString();
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.

@@ -0,0 +1,84 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The engine repo enforces 2013 through the license check script.


const String kNameKey = 'name';
const String kTimeUnitKey = 'time_unit';

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.

const String kNameKey = 'name';
const String kTimeUnitKey = 'time_unit';

const List<String> kSkippedSubResults = <String>[
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are not the numerical values of metrics. Renamed kSkippedSubResults to kNonNumericalValueSubResults for clarity.


final List<FlutterEngineMetricPoint> points = <FlutterEngineMetricPoint>[];
for (Map<String, dynamic> item in jsonResult['benchmarks']) {
final String name = item[kNameKey];
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.

if (args.length != 1) {
throw 'Must have one argument: <benchmark_json_file>';
}
final List<FlutterEngineMetricPoint> points = await _parse(args[0]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current code generates the following error when the file does not exist:

Unhandled exception:
FileSystemException: Cannot open file, path = 'test.json' (OS Error: No such file or directory, errno = 2)

Does that look good?

throw 'Must have one argument: <benchmark_json_file>';
}
final List<FlutterEngineMetricPoint> points = await _parse(args[0]);
final FlutterDestination destination =
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.

metrics_center:
# TODO(liyuqian): once metrics_center is properly reviewed, add it to
# flutter/packages, publish on pub.dev, and use the published package here.
git: https://github.com/liyuqian/metrics_center.git
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Metric center is mainly responsible for extract, transform, and load from some metric database (e.g., cocoon) to some other metric database (e.g., skiaperf). Metric center is itself a database so a client (the engine repo) can directly write metrics into it.

In this case, I intended to only put the client code/logic in the engine repo. That said, I should probably put the transform code (_parse) in the metric center repo, so if some future client also needs to transform https://github.com/google/benchmark results, it doesn't have to rewrite the code.

Thanks for the suggestion!

@@ -0,0 +1,20 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same enforcement of 2013 unfortunately...

void main() {
test('parse_and_send with example json does not crash.', () async {
final String testCred =
File('secret/test_gcp_credentials.json').readAsStringSync();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One should download a service account credentials json from a test GCP project, and put that json as secret/test_gcp_credentials.json. There's a flutter-test project for Flutter team members. I'll add this instruction to the code.

Copy link
Contributor

@keyonghan keyonghan left a comment

Choose a reason for hiding this comment

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

LGTM

This will start to collect engine benchmarks in the flutter-cirrus
Datastore for all post-submit commits.

We're using this to test how https://github.com/liyuqian/metrics_center
works. Once it's stablized, we should move metrics_center into
flutter/packages, and migrate data to flutter-infra Datastore.
@liyuqian
Copy link
Contributor Author

@liyuqian liyuqian merged commit 17fa0fa into flutter:master Dec 24, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 26, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 26, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 26, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Dec 26, 2019
flutter/engine@42bb7c9...dc0187f

git log 42bb7c9..dc0187f --first-parent --oneline
2019-12-24 [email protected] Roll src/third_party/dart 8736fec094bb..75fc15c7e186 (6 commits) (flutter/engine#14679)
2019-12-24 [email protected] Run and collect benchmarks (flutter/engine#14556)
2019-12-23 [email protected] Roll src/third_party/dart 4a639e8df261..8736fec094bb (11 commits) (flutter/engine#14678)
2019-12-23 [email protected] Roll src/third_party/skia ac29f1342fd2..a2d7225c0fc1 (5 commits) (flutter/engine#14677)
2019-12-23 [email protected] fix selection issue (flutter/engine#14604)
2019-12-23 [email protected] Roll fuchsia/sdk/core/linux-amd64 from TUoVa... to v3R8A... (flutter/engine#14670)
2019-12-23 [email protected] Roll src/third_party/dart cfca5ea9f2e9..4a639e8df261 (7 commits) (flutter/engine#14671)
2019-12-23 [email protected] Roll src/third_party/skia 6ec826085b2a..ac29f1342fd2 (1 commits) (flutter/engine#14672)
2019-12-23 [email protected] Roll fuchsia/sdk/core/mac-amd64 from IZ278... to ZA31z... (flutter/engine#14675)
2019-12-21 [email protected] Roll src/third_party/dart 1db1a837f8c9..cfca5ea9f2e9 (2 commits) (flutter/engine#14667)
2019-12-21 [email protected] Roll src/third_party/skia 2723af6a6d43..6ec826085b2a (3 commits) (flutter/engine#14665)
2019-12-21 [email protected] Roll src/third_party/dart c260e4e8dac6..1db1a837f8c9 (8 commits) (flutter/engine#14606)
2019-12-21 [email protected] Roll src/third_party/skia 28b0c5d4b3bb..2723af6a6d43 (4 commits) (flutter/engine#14605)
2019-12-20 [email protected] View ref pair (flutter/engine#14602)
2019-12-20 [email protected] Roll fuchsia/sdk/core/mac-amd64 from VC7eE... to IZ278... (flutter/engine#14603)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 28, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Dec 28, 2019
flutter/engine@5a730c6...bdc9708

git log 5a730c6..bdc9708 --first-parent --oneline
2019-12-28 [email protected] Revert "Use ELF for Dart AOT snapshots on Fuchsia. (#13896)" (flutter/engine#14823)
2019-12-27 [email protected] Roll src/third_party/skia 89bf1547f3aa..5a2f962313a5 (16 commits) (flutter/engine#14825)
2019-12-27 [email protected] Roll fuchsia/sdk/core/linux-amd64 from ikxBh... to sxapd... (flutter/engine#14821)
2019-12-27 [email protected] Roll fuchsia/sdk/core/mac-amd64 from IEPKx... to iImpF... (flutter/engine#14817)
2019-12-27 [email protected] Roll src/third_party/dart 94a4f6415e6c..c547f5d933e5 (9 commits) (flutter/engine#14812)
2019-12-27 [email protected] Roll src/third_party/skia f2d522a3f434..89bf1547f3aa (4 commits) (flutter/engine#14814)
2019-12-26 [email protected] Roll src/third_party/dart 232a171a0b1c..94a4f6415e6c (8 commits) (flutter/engine#14808)
2019-12-26 [email protected] Roll src/third_party/skia 07d744fb8a53..f2d522a3f434 (4 commits) (flutter/engine#14807)
2019-12-26 [email protected] Roll src/third_party/skia 05eb83be171c..07d744fb8a53 (3 commits) (flutter/engine#14806)
2019-12-26 [email protected] Roll fuchsia/sdk/core/linux-amd64 from v3R8A... to ikxBh... (flutter/engine#14802)
2019-12-26 [email protected] Roll src/third_party/dart 75fc15c7e186..232a171a0b1c (4 commits) (flutter/engine#14803)
2019-12-26 [email protected] Roll fuchsia/sdk/core/mac-amd64 from ZA31z... to IEPKx... (flutter/engine#14702)
2019-12-26 [email protected] Roll src/third_party/skia 3d3150c89c5f..05eb83be171c (3 commits) (flutter/engine#14800)
2019-12-24 [email protected] Roll src/third_party/skia a2d7225c0fc1..3d3150c89c5f (1 commits) (flutter/engine#14680)
2019-12-24 [email protected] Roll src/third_party/dart 8736fec094bb..75fc15c7e186 (6 commits) (flutter/engine#14679)
2019-12-24 [email protected] Run and collect benchmarks (flutter/engine#14556)
2019-12-23 [email protected] Roll src/third_party/dart 4a639e8df261..8736fec094bb (11 commits) (flutter/engine#14678)
2019-12-23 [email protected] Roll src/third_party/skia ac29f1342fd2..a2d7225c0fc1 (5 commits) (flutter/engine#14677)
2019-12-23 [email protected] fix selection issue (flutter/engine#14604)
2019-12-23 [email protected] Roll fuchsia/sdk/core/linux-amd64 from TUoVa... to v3R8A... (flutter/engine#14670)
2019-12-23 [email protected] Roll src/third_party/dart cfca5ea9f2e9..4a639e8df261 (7 commits) (flutter/engine#14671)
2019-12-23 [email protected] Roll src/third_party/skia 6ec826085b2a..ac29f1342fd2 (1 commits) (flutter/engine#14672)
2019-12-23 [email protected] Roll fuchsia/sdk/core/mac-amd64 from IZ278... to ZA31z... (flutter/engine#14675)
2019-12-21 [email protected] Roll src/third_party/dart 1db1a837f8c9..cfca5ea9f2e9 (2 commits) (flutter/engine#14667)
2019-12-21 [email protected] Roll src/third_party/skia 2723af6a6d43..6ec826085b2a (3 commits) (flutter/engine#14665)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
@liyuqian liyuqian deleted the benchmark branch March 2, 2020 19:21
filmil pushed a commit to filmil/engine that referenced this pull request Mar 13, 2020
This will start to collect engine benchmarks in the flutter-cirrus
Datastore for all post-submit commits.

We're using this to test how https://github.com/liyuqian/metrics_center
works. Once it's stablized, we should move metrics_center into
flutter/packages, and migrate data to flutter-infra Datastore.

Related issue: flutter/flutter#37434
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants