From 468b4317433b00b69d77820eba77d11a24f6426a Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Mon, 13 Sep 2021 13:57:59 -0700 Subject: [PATCH] Parse the benchmarks on presubmit jobs (#28586) --- .ci.yaml | 10 ++++++++ testing/benchmark/bin/parse_and_send.dart | 28 ++++++++++++++++++++--- testing/benchmark/pubspec.yaml | 5 +++- testing/benchmark/upload_metrics.sh | 8 +++---- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/.ci.yaml b/.ci.yaml index fe65209a63..a920ab83a7 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -142,6 +142,16 @@ targets: presubmit: false properties: build_host: "true" + upload_metrics: "true" + timeout: 60 + scheduler: luci + + - name: Linux Benchmarks (no-upload) + bringup: true + recipe: engine/engine_metrics + properties: + build_host: "true" + upload_metrics: "false" timeout: 60 scheduler: luci diff --git a/testing/benchmark/bin/parse_and_send.dart b/testing/benchmark/bin/parse_and_send.dart index b6319aff3f..0a5e04b63b 100644 --- a/testing/benchmark/bin/parse_and_send.dart +++ b/testing/benchmark/bin/parse_and_send.dart @@ -7,6 +7,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:args/args.dart'; import 'package:metrics_center/metrics_center.dart'; import 'package:path/path.dart' as p; @@ -81,11 +82,32 @@ Future connectFlutterDestination() async { ); } +ArgParser _serupOptions() { + final ArgParser parser = ArgParser(); + parser.addOption( + 'json', + mandatory: true, + help: 'Path to the benchmarks json file.', + ); + parser.addFlag( + 'no-upload', + help: 'Upload the parsed benchmarks.', + defaultsTo: false, + ); + return parser; +} + Future main(List args) async { - if (args.length != 1) { - throw 'Must have one argument: '; + final ArgParser parser = _serupOptions(); + final ArgResults options = parser.parse(args); + + final String json = options['json'] as String; + final PointsAndDate pointsAndDate = await parse(json); + + final bool noUpload = options['no-upload'] as bool; + if (noUpload) { + return; } - final PointsAndDate pointsAndDate = await parse(args[0]); // The data will be sent to the Datastore of the GCP project specified through // environment variable BENCHMARK_GCP_CREDENTIALS, or TOKEN_PATH/GCP_PROJECT. diff --git a/testing/benchmark/pubspec.yaml b/testing/benchmark/pubspec.yaml index 9a022df136..31e05f21d4 100644 --- a/testing/benchmark/pubspec.yaml +++ b/testing/benchmark/pubspec.yaml @@ -5,7 +5,7 @@ name: flutter_engine_benchmark publish_to: none environment: - sdk: ">=2.2.2 <3.0.0" + sdk: '>=2.12.0-0 <3.0.0' # Do not add any dependencies that require more than what is provided in # //third_party/pkg, //third_party/dart/pkg, or @@ -17,6 +17,7 @@ environment: # relative to this directory into //third_party/dart dependencies: + args: any metrics_center: any path: any @@ -26,6 +27,8 @@ dev_dependencies: dependency_overrides: _discoveryapis_commons: path: ../../../third_party/pkg/googleapis/discoveryapis_commons + args: + path: ../../../third_party/dart/third_party/pkg/args async_helper: path: ../../../third_party/dart/pkg/async_helper async: diff --git a/testing/benchmark/upload_metrics.sh b/testing/benchmark/upload_metrics.sh index 91f29df307..f2a1b3acde 100644 --- a/testing/benchmark/upload_metrics.sh +++ b/testing/benchmark/upload_metrics.sh @@ -37,10 +37,10 @@ DART="${DART_SDK_DIR}/bin/dart" cd "$SCRIPT_DIR" "$DART" --disable-dart-dev bin/parse_and_send.dart \ - ../../../out/host_release/txt_benchmarks.json + --json ../../../out/host_release/txt_benchmarks.json "$@" "$DART" --disable-dart-dev bin/parse_and_send.dart \ - ../../../out/host_release/fml_benchmarks.json + --json ../../../out/host_release/fml_benchmarks.json "$@" "$DART" --disable-dart-dev bin/parse_and_send.dart \ - ../../../out/host_release/shell_benchmarks.json + --json ../../../out/host_release/shell_benchmarks.json "$@" "$DART" --disable-dart-dev bin/parse_and_send.dart \ - ../../../out/host_release/ui_benchmarks.json + --json ../../../out/host_release/ui_benchmarks.json "$@" -- GitLab