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

Commit 468b431

Browse files
authored
Parse the benchmarks on presubmit jobs (#28586)
1 parent 22730fb commit 468b431

File tree

4 files changed

+43
-8
lines changed

4 files changed

+43
-8
lines changed

.ci.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ targets:
142142
presubmit: false
143143
properties:
144144
build_host: "true"
145+
upload_metrics: "true"
146+
timeout: 60
147+
scheduler: luci
148+
149+
- name: Linux Benchmarks (no-upload)
150+
bringup: true
151+
recipe: engine/engine_metrics
152+
properties:
153+
build_host: "true"
154+
upload_metrics: "false"
145155
timeout: 60
146156
scheduler: luci
147157

testing/benchmark/bin/parse_and_send.dart

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import 'dart:convert';
88
import 'dart:io';
99

10+
import 'package:args/args.dart';
1011
import 'package:metrics_center/metrics_center.dart';
1112
import 'package:path/path.dart' as p;
1213

@@ -81,11 +82,32 @@ Future<FlutterDestination> connectFlutterDestination() async {
8182
);
8283
}
8384

85+
ArgParser _serupOptions() {
86+
final ArgParser parser = ArgParser();
87+
parser.addOption(
88+
'json',
89+
mandatory: true,
90+
help: 'Path to the benchmarks json file.',
91+
);
92+
parser.addFlag(
93+
'no-upload',
94+
help: 'Upload the parsed benchmarks.',
95+
defaultsTo: false,
96+
);
97+
return parser;
98+
}
99+
84100
Future<void> main(List<String> args) async {
85-
if (args.length != 1) {
86-
throw 'Must have one argument: <benchmark_json_file>';
101+
final ArgParser parser = _serupOptions();
102+
final ArgResults options = parser.parse(args);
103+
104+
final String json = options['json'] as String;
105+
final PointsAndDate pointsAndDate = await parse(json);
106+
107+
final bool noUpload = options['no-upload'] as bool;
108+
if (noUpload) {
109+
return;
87110
}
88-
final PointsAndDate pointsAndDate = await parse(args[0]);
89111

90112
// The data will be sent to the Datastore of the GCP project specified through
91113
// environment variable BENCHMARK_GCP_CREDENTIALS, or TOKEN_PATH/GCP_PROJECT.

testing/benchmark/pubspec.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
name: flutter_engine_benchmark
66
publish_to: none
77
environment:
8-
sdk: ">=2.2.2 <3.0.0"
8+
sdk: '>=2.12.0-0 <3.0.0'
99

1010
# Do not add any dependencies that require more than what is provided in
1111
# //third_party/pkg, //third_party/dart/pkg, or
@@ -17,6 +17,7 @@ environment:
1717
# relative to this directory into //third_party/dart
1818

1919
dependencies:
20+
args: any
2021
metrics_center: any
2122
path: any
2223

@@ -26,6 +27,8 @@ dev_dependencies:
2627
dependency_overrides:
2728
_discoveryapis_commons:
2829
path: ../../../third_party/pkg/googleapis/discoveryapis_commons
30+
args:
31+
path: ../../../third_party/dart/third_party/pkg/args
2932
async_helper:
3033
path: ../../../third_party/dart/pkg/async_helper
3134
async:

testing/benchmark/upload_metrics.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ DART="${DART_SDK_DIR}/bin/dart"
3737

3838
cd "$SCRIPT_DIR"
3939
"$DART" --disable-dart-dev bin/parse_and_send.dart \
40-
../../../out/host_release/txt_benchmarks.json
40+
--json ../../../out/host_release/txt_benchmarks.json "$@"
4141
"$DART" --disable-dart-dev bin/parse_and_send.dart \
42-
../../../out/host_release/fml_benchmarks.json
42+
--json ../../../out/host_release/fml_benchmarks.json "$@"
4343
"$DART" --disable-dart-dev bin/parse_and_send.dart \
44-
../../../out/host_release/shell_benchmarks.json
44+
--json ../../../out/host_release/shell_benchmarks.json "$@"
4545
"$DART" --disable-dart-dev bin/parse_and_send.dart \
46-
../../../out/host_release/ui_benchmarks.json
46+
--json ../../../out/host_release/ui_benchmarks.json "$@"

0 commit comments

Comments
 (0)