benchmarkLive: a new LiveTestWidgetsFlutterBindingFramePolicy for benchmark on device (#61388)

* add benchmarkLive flag and tests

* update handlePointerEventRecord doc

* using e2e 0.6.1
This commit is contained in:
Ming Lyu (CareF)
2020-07-17 18:56:12 -04:00
committed by GitHub
parent 09dfca6f5d
commit 54c9441723
12 changed files with 278 additions and 6 deletions

View File

@@ -0,0 +1,14 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/perf_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(createFramePolicyIntegrationTest());
}

View File

@@ -262,6 +262,49 @@ TaskFunction createsMultiWidgetConstructPerfTest() {
).run;
}
TaskFunction createFramePolicyIntegrationTest() {
final String testDirectory =
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks';
const String testTarget = 'test/frame_policy.dart';
return () {
return inDirectory<TaskResult>(testDirectory, () async {
final Device device = await devices.workingDevice;
await device.unlock();
final String deviceId = device.deviceId;
await flutter('packages', options: <String>['get']);
await flutter('drive', options: <String>[
'-v',
'--verbose-system-logs',
'--profile',
'-t', testTarget,
'-d',
deviceId,
]);
final Map<String, dynamic> data = json.decode(
file('$testDirectory/build/frame_policy_event_delay.json').readAsStringSync(),
) as Map<String, dynamic>;
final Map<String, dynamic> fullLiveData = data['fullyLive'] as Map<String, dynamic>;
final Map<String, dynamic> benchmarkLiveData = data['benchmarkLive'] as Map<String, dynamic>;
final Map<String, dynamic> dataFormated = <String, dynamic>{
'average_delay_fullyLive_millis':
fullLiveData['average_delay_millis'],
'average_delay_benchmarkLive_millis':
benchmarkLiveData['average_delay_millis'],
'90th_percentile_delay_fullyLive_millis':
fullLiveData['90th_percentile_delay_millis'],
'90th_percentile_delay_benchmarkLive_millis':
benchmarkLiveData['90th_percentile_delay_millis'],
};
return TaskResult.success(
dataFormated,
benchmarkScoreKeys: dataFormated.keys.toList(),
);
});
};
}
/// Measure application startup performance.
class StartupTest {
const StartupTest(this.testDirectory, { this.reportMetrics = true });

View File

@@ -167,6 +167,13 @@ tasks:
stage: devicelab
required_agent_capabilities: ["linux/android"]
frame_policy_delay_test_android:
description: >
Tests the effect of LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive
stage: devicelab
required_agent_capabilities: ["linux/android"]
flaky: true
picture_cache_perf__timeline_summary:
description: >
Measures the runtime performance of raster caching many pictures on Android.