Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
db4c104c
Unverified
Commit
db4c104c
authored
Aug 27, 2021
by
keyonghan
Committed by
GitHub
Aug 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use task name when uploading metrics to skia perf (#89004)
parent
7df68b90
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
13 deletions
+99
-13
pubspec.yaml
dev/bots/pubspec.yaml
+2
-2
upload_results.dart
dev/devicelab/lib/command/upload_results.dart
+3
-1
metrics_center.dart
dev/devicelab/lib/framework/metrics_center.dart
+27
-8
pubspec.yaml
dev/devicelab/pubspec.yaml
+2
-2
metrics_center_test.dart
dev/devicelab/test/metrics_center_test.dart
+65
-0
No files found.
dev/bots/pubspec.yaml
View file @
db4c104c
...
...
@@ -42,7 +42,7 @@ dependencies:
json_annotation
:
4.1.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
logging
:
1.0.1
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher
:
0.12.11
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
metrics_center
:
1.0.
0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
metrics_center
:
1.0.
1
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
mime
:
1.0.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
node_preamble
:
2.0.1
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
package_config
:
2.0.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
...
...
@@ -72,4 +72,4 @@ dependencies:
dev_dependencies
:
test_api
:
0.4.3
# PUBSPEC CHECKSUM:
e827
# PUBSPEC CHECKSUM:
3028
dev/devicelab/lib/command/upload_results.dart
View file @
db4c104c
...
...
@@ -21,6 +21,7 @@ class UploadResultsCommand extends Command<void> {
'checkouts run in detached HEAD state, so the branch must be passed.'
,
);
argParser
.
addOption
(
'luci-builder'
,
help:
'[Flutter infrastructure] Name of the LUCI builder being run on.'
);
argParser
.
addOption
(
'task-name'
,
help:
'[Flutter infrastructure] Name of the task being run on.'
);
argParser
.
addOption
(
'test-status'
,
help:
'Test status: Succeeded|Failed'
);
argParser
.
addOption
(
'commit-time'
,
help:
'Commit time in UNIX timestamp'
);
}
...
...
@@ -40,6 +41,7 @@ class UploadResultsCommand extends Command<void> {
final
String
?
builderName
=
argResults
![
'luci-builder'
]
as
String
?;
final
String
?
testStatus
=
argResults
![
'test-status'
]
as
String
?;
final
String
?
commitTime
=
argResults
![
'commit-time'
]
as
String
?;
final
String
?
taskName
=
argResults
![
'task-name'
]
as
String
?;
// Upload metrics to metrics_center from test runner when `commitTime` is specified. This
// is mainly for testing purpose.
...
...
@@ -47,7 +49,7 @@ class UploadResultsCommand extends Command<void> {
// TODO(keyong): remove try block to block test when this is validated to work https://github.com/flutter/flutter/issues/88484
try
{
if
(
commitTime
!=
null
)
{
await
uploadToMetricsCenter
(
resultsPath
,
commitTime
);
await
uploadToMetricsCenter
(
resultsPath
,
commitTime
,
taskName
);
print
(
'Successfully uploaded metrics to metrics center'
);
}
}
on
Exception
catch
(
e
,
stacktrace
)
{
...
...
dev/devicelab/lib/framework/metrics_center.dart
View file @
db4c104c
...
...
@@ -70,8 +70,33 @@ List<MetricPoint> parse(Map<String, dynamic> resultsJson) {
return
metricPoints
;
}
/// Upload metrics to GCS bucket used by Skia Perf.
///
/// Skia Perf picks up all available files under the folder, and
/// is robust to duplicate entries.
///
/// Files will be named based on `taskName`, such as
/// `complex_layout_scroll_perf__timeline_summary_values.json`.
/// If no `taskName` is specified, data will be saved to
/// `default_values.json`.
Future
<
void
>
upload
(
FlutterDestination
metricsDestination
,
List
<
MetricPoint
>
metricPoints
,
int
commitTimeSinceEpoch
,
String
?
taskName
,
)
async
{
await
metricsDestination
.
update
(
metricPoints
,
DateTime
.
fromMillisecondsSinceEpoch
(
commitTimeSinceEpoch
,
isUtc:
true
,
),
taskName
??
'default'
,
);
}
/// Upload test metrics to metrics center.
Future
<
void
>
uploadToMetricsCenter
(
String
?
resultsPath
,
String
?
commitTime
)
async
{
Future
<
void
>
uploadToMetricsCenter
(
String
?
resultsPath
,
String
?
commitTime
,
String
?
taskName
)
async
{
int
commitTimeSinceEpoch
;
if
(
resultsPath
==
null
)
{
return
;
...
...
@@ -86,11 +111,5 @@ Future<void> uploadToMetricsCenter(String? resultsPath, String? commitTime) asyn
resultsJson
=
json
.
decode
(
await
resultFile
.
readAsString
())
as
Map
<
String
,
dynamic
>;
final
List
<
MetricPoint
>
metricPoints
=
parse
(
resultsJson
);
final
FlutterDestination
metricsDestination
=
await
connectFlutterDestination
();
await
metricsDestination
.
update
(
metricPoints
,
DateTime
.
fromMillisecondsSinceEpoch
(
commitTimeSinceEpoch
,
isUtc:
true
,
),
);
await
upload
(
metricsDestination
,
metricPoints
,
commitTimeSinceEpoch
,
taskName
);
}
dev/devicelab/pubspec.yaml
View file @
db4c104c
...
...
@@ -11,7 +11,7 @@ dependencies:
file
:
6.1.2
http
:
0.13.3
meta
:
1.7.0
metrics_center
:
1.0.
0
metrics_center
:
1.0.
1
path
:
1.8.0
platform
:
3.0.2
process
:
4.2.3
...
...
@@ -73,4 +73,4 @@ dev_dependencies:
web_socket_channel
:
2.1.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
webkit_inspection_protocol
:
1.0.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
# PUBSPEC CHECKSUM:
e827
# PUBSPEC CHECKSUM:
3028
dev/devicelab/test/metrics_center_test.dart
View file @
db4c104c
...
...
@@ -7,6 +7,21 @@ import 'package:metrics_center/metrics_center.dart';
import
'common.dart'
;
class
FakeFlutterDestination
implements
FlutterDestination
{
/// Overrides the skia perf `update` function, which uploads new data to gcs if there
/// doesn't exist the commit, otherwise updates existing data by appending new ones.
@override
Future
<
void
>
update
(
List
<
MetricPoint
>
points
,
DateTime
commitTime
,
String
taskName
)
async
{
lastUpdatedPoints
=
points
;
time
=
commitTime
;
name
=
taskName
;
}
List
<
MetricPoint
>?
lastUpdatedPoints
;
DateTime
?
time
;
String
?
name
;
}
void
main
(
)
{
group
(
'Parse'
,
()
{
test
(
'succeeds'
,
()
{
...
...
@@ -42,4 +57,54 @@ void main() {
expect
(
metricPoints
.
length
,
0
);
});
});
group
(
'Update'
,
()
{
test
(
'without taskName'
,
()
async
{
final
Map
<
String
,
dynamic
>
results
=
<
String
,
dynamic
>{
'CommitBranch'
:
'master'
,
'CommitSha'
:
'abc'
,
'BuilderName'
:
'test'
,
'ResultData'
:
<
String
,
dynamic
>{
'average_frame_build_time_millis'
:
0.4550425531914895
,
'90th_percentile_frame_build_time_millis'
:
0.473
,
},
'BenchmarkScoreKeys'
:
<
String
>[
'average_frame_build_time_millis'
,
'90th_percentile_frame_build_time_millis'
,
],
};
final
List
<
MetricPoint
>
metricPoints
=
parse
(
results
);
final
FakeFlutterDestination
flutterDestination
=
FakeFlutterDestination
();
String
?
taskName
;
const
int
commitTimeSinceEpoch
=
1629220312
;
await
upload
(
flutterDestination
,
metricPoints
,
commitTimeSinceEpoch
,
taskName
);
expect
(
flutterDestination
.
name
,
'default'
);
});
test
(
'with taskName'
,
()
async
{
final
Map
<
String
,
dynamic
>
results
=
<
String
,
dynamic
>{
'CommitBranch'
:
'master'
,
'CommitSha'
:
'abc'
,
'BuilderName'
:
'test'
,
'ResultData'
:
<
String
,
dynamic
>{
'average_frame_build_time_millis'
:
0.4550425531914895
,
'90th_percentile_frame_build_time_millis'
:
0.473
,
},
'BenchmarkScoreKeys'
:
<
String
>[
'average_frame_build_time_millis'
,
'90th_percentile_frame_build_time_millis'
,
],
};
final
List
<
MetricPoint
>
metricPoints
=
parse
(
results
);
final
FakeFlutterDestination
flutterDestination
=
FakeFlutterDestination
();
const
String
taskName
=
'test'
;
const
int
commitTimeSinceEpoch
=
1629220312
;
await
upload
(
flutterDestination
,
metricPoints
,
commitTimeSinceEpoch
,
taskName
);
expect
(
flutterDestination
.
name
,
taskName
);
});
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment