Revert "Measure iOS CPU/GPU percentage (#39439)" (#40624)

This reverts commit af9f424d5d.

Reverts flutter/flutter#39439

Reason: this passed the local device lab test on my Macbook but it failed in the actual device lab. Will investigate, fix, and reland.

TBR: @dnfield @goderbauer @tvolkert @Hixie
This commit is contained in:
liyuqian
2019-09-16 15:00:27 -07:00
committed by GitHub
parent 390ef60963
commit 652be88ecd
11 changed files with 6 additions and 142 deletions

View File

@@ -10,5 +10,5 @@ import 'package:flutter_devicelab/framework/framework.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(createBackdropFilterPerfTest(needsMeasureCpuGpu: true));
await task(createBackdropFilterPerfTest());
}

View File

@@ -1,13 +0,0 @@
// Copyright 2019 The Chromium 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 '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.ios;
await task(createSimpleAnimationPerfTest(needsMeasureCpuGpu: true));
}

View File

@@ -622,45 +622,3 @@ void checkFileExists(String file) {
throw FileSystemException('Expected file to exit.', file);
}
}
void _checkExitCode(int code) {
if (code != 0) {
throw Exception(
'Unexpected exit code = $code!',
);
}
}
Future<void> _execAndCheck(String executable, List<String> args) async {
_checkExitCode(await exec(executable, args));
}
// Measure the CPU/GPU percentage for [duration] while a Flutter app is running
// on an iOS device (e.g., right after a Flutter driver test has finished, which
// doesn't close the Flutter app, and the Flutter app has an indefinite
// animation). The return should have a format like the following json
// ```
// {"gpu_percentage":12.6,"cpu_percentage":18.15}
// ```
Future<Map<String, dynamic>> measureIosCpuGpu({
Duration duration = const Duration(seconds: 10),
String deviceId,
}) async {
await _execAndCheck('pub', <String>[
'global',
'activate',
'gauge',
]);
await _execAndCheck('pub', <String>[
'global',
'run',
'gauge',
'ioscpugpu',
'new',
if (deviceId != null) ...<String>['-w', deviceId],
'-l',
'${duration.inMilliseconds}',
]);
return json.decode(file('$cwd/result.json').readAsStringSync());
}

View File

@@ -54,21 +54,11 @@ TaskFunction createCubicBezierPerfTest() {
).run;
}
TaskFunction createBackdropFilterPerfTest({bool needsMeasureCpuGpu = false}) {
TaskFunction createBackdropFilterPerfTest() {
return PerfTest(
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
'test_driver/backdrop_filter_perf.dart',
'backdrop_filter_perf',
needsMeasureCpuGPu: needsMeasureCpuGpu,
).run;
}
TaskFunction createSimpleAnimationPerfTest({bool needsMeasureCpuGpu = false}) {
return PerfTest(
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
'test_driver/simple_animation_perf.dart',
'simple_animation_perf',
needsMeasureCpuGPu: needsMeasureCpuGpu,
).run;
}
@@ -178,18 +168,12 @@ class StartupTest {
/// Measures application runtime performance, specifically per-frame
/// performance.
class PerfTest {
const PerfTest(
this.testDirectory,
this.testTarget,
this.timelineFileName,
{this.needsMeasureCpuGPu = false});
const PerfTest(this.testDirectory, this.testTarget, this.timelineFileName);
final String testDirectory;
final String testTarget;
final String timelineFileName;
final bool needsMeasureCpuGPu;
Future<TaskResult> run() {
return inDirectory<TaskResult>(testDirectory, () async {
final Device device = await devices.workingDevice;
@@ -218,12 +202,6 @@ class PerfTest {
);
}
if (needsMeasureCpuGPu) {
await inDirectory<void>('$testDirectory/build', () async {
data.addAll(await measureIosCpuGpu(deviceId: deviceId));
});
}
return TaskResult.success(data, benchmarkScoreKeys: <String>[
'average_frame_build_time_millis',
'worst_frame_build_time_millis',
@@ -235,8 +213,6 @@ class PerfTest {
'missed_frame_rasterizer_budget_count',
'90th_percentile_frame_rasterizer_time_millis',
'99th_percentile_frame_rasterizer_time_millis',
if (needsMeasureCpuGPu) 'cpu_percentage',
if (needsMeasureCpuGPu) 'gpu_percentage',
]);
});
}

View File

@@ -535,12 +535,6 @@ tasks:
stage: devicelab_ios
required_agent_capabilities: ["mac/ios"]
simple_animation_perf_ios:
description: >
Measure CPU/GPU usage percentages of a simple animation.
stage: devicelab_ios
required_agent_capabilities: ["mac/ios"]
smoke_catalina_start_up_ios:
description: >
A smoke test that runs on macOS Catalina, which is a clone of the Gallery startup latency test.