Skip to content

Commit 9026f7d

Browse files
liyuqianInconnu08
authored andcommitted
Revert "Measure iOS CPU/GPU percentage (flutter#39439)" (flutter#40624)
This reverts commit af9f424. Reverts 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
1 parent d4ed306 commit 9026f7d

File tree

11 files changed

+6
-142
lines changed

11 files changed

+6
-142
lines changed

dev/benchmarks/macrobenchmarks/lib/common.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
const String kCullOpacityRouteName = '/cull_opacity';
66
const String kCubicBezierRouteName = '/cubic_bezier';
77
const String kBackdropFilterRouteName = '/backdrop_filter';
8-
const String kSimpleAnimationRouteName = '/simple_animation';

dev/benchmarks/macrobenchmarks/lib/main.dart

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'common.dart';
88
import 'src/backdrop_filter.dart';
99
import 'src/cubic_bezier.dart';
1010
import 'src/cull_opacity.dart';
11-
import 'src/simple_animation.dart';
1211

1312
const String kMacrobenchmarks ='Macrobenchmarks';
1413

@@ -25,7 +24,6 @@ class MacrobenchmarksApp extends StatelessWidget {
2524
kCullOpacityRouteName: (BuildContext context) => CullOpacityPage(),
2625
kCubicBezierRouteName: (BuildContext context) => CubicBezierPage(),
2726
kBackdropFilterRouteName: (BuildContext context) => BackdropFilterPage(),
28-
kSimpleAnimationRouteName: (BuildContext conttext) => SimpleAnimationPage(),
2927
},
3028
);
3129
}
@@ -41,31 +39,24 @@ class HomePage extends StatelessWidget {
4139
RaisedButton(
4240
key: const Key(kCullOpacityRouteName),
4341
child: const Text('Cull opacity'),
44-
onPressed: () {
42+
onPressed: (){
4543
Navigator.pushNamed(context, kCullOpacityRouteName);
4644
},
4745
),
4846
RaisedButton(
4947
key: const Key(kCubicBezierRouteName),
5048
child: const Text('Cubic Bezier'),
51-
onPressed: () {
49+
onPressed: (){
5250
Navigator.pushNamed(context, kCubicBezierRouteName);
5351
},
5452
),
5553
RaisedButton(
5654
key: const Key(kBackdropFilterRouteName),
5755
child: const Text('Backdrop Filter'),
58-
onPressed: () {
56+
onPressed: (){
5957
Navigator.pushNamed(context, kBackdropFilterRouteName);
6058
},
6159
),
62-
RaisedButton(
63-
key: const Key(kSimpleAnimationRouteName),
64-
child: const Text('Simple Animation'),
65-
onPressed: () {
66-
Navigator.pushNamed(context, kSimpleAnimationRouteName);
67-
},
68-
),
6960
],
7061
),
7162
);

dev/benchmarks/macrobenchmarks/lib/src/backdrop_filter.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// Copyright 2019 The Chromium Authors. All rights reserved.
2-
// Use of this source code is governed by a BSD-style license that can be
3-
// found in the LICENSE file.
4-
51
import 'dart:ui';
62

73
import 'package:flutter/material.dart';

dev/benchmarks/macrobenchmarks/lib/src/simple_animation.dart

Lines changed: 0 additions & 12 deletions
This file was deleted.

dev/benchmarks/macrobenchmarks/test_driver/simple_animation_perf.dart

Lines changed: 0 additions & 11 deletions
This file was deleted.

dev/benchmarks/macrobenchmarks/test_driver/simple_animation_perf_test.dart

Lines changed: 0 additions & 14 deletions
This file was deleted.

dev/devicelab/bin/tasks/backdrop_filter_perf_ios__timeline_summary.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ import 'package:flutter_devicelab/framework/framework.dart';
1010

1111
Future<void> main() async {
1212
deviceOperatingSystem = DeviceOperatingSystem.ios;
13-
await task(createBackdropFilterPerfTest(needsMeasureCpuGpu: true));
13+
await task(createBackdropFilterPerfTest());
1414
}

dev/devicelab/bin/tasks/simple_animation_perf_ios.dart

Lines changed: 0 additions & 13 deletions
This file was deleted.

dev/devicelab/lib/framework/utils.dart

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -622,45 +622,3 @@ void checkFileExists(String file) {
622622
throw FileSystemException('Expected file to exit.', file);
623623
}
624624
}
625-
626-
void _checkExitCode(int code) {
627-
if (code != 0) {
628-
throw Exception(
629-
'Unexpected exit code = $code!',
630-
);
631-
}
632-
}
633-
634-
Future<void> _execAndCheck(String executable, List<String> args) async {
635-
_checkExitCode(await exec(executable, args));
636-
}
637-
638-
// Measure the CPU/GPU percentage for [duration] while a Flutter app is running
639-
// on an iOS device (e.g., right after a Flutter driver test has finished, which
640-
// doesn't close the Flutter app, and the Flutter app has an indefinite
641-
// animation). The return should have a format like the following json
642-
// ```
643-
// {"gpu_percentage":12.6,"cpu_percentage":18.15}
644-
// ```
645-
Future<Map<String, dynamic>> measureIosCpuGpu({
646-
Duration duration = const Duration(seconds: 10),
647-
String deviceId,
648-
}) async {
649-
await _execAndCheck('pub', <String>[
650-
'global',
651-
'activate',
652-
'gauge',
653-
]);
654-
655-
await _execAndCheck('pub', <String>[
656-
'global',
657-
'run',
658-
'gauge',
659-
'ioscpugpu',
660-
'new',
661-
if (deviceId != null) ...<String>['-w', deviceId],
662-
'-l',
663-
'${duration.inMilliseconds}',
664-
]);
665-
return json.decode(file('$cwd/result.json').readAsStringSync());
666-
}

dev/devicelab/lib/tasks/perf_tests.dart

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,11 @@ TaskFunction createCubicBezierPerfTest() {
5454
).run;
5555
}
5656

57-
TaskFunction createBackdropFilterPerfTest({bool needsMeasureCpuGpu = false}) {
57+
TaskFunction createBackdropFilterPerfTest() {
5858
return PerfTest(
5959
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
6060
'test_driver/backdrop_filter_perf.dart',
6161
'backdrop_filter_perf',
62-
needsMeasureCpuGPu: needsMeasureCpuGpu,
63-
).run;
64-
}
65-
66-
TaskFunction createSimpleAnimationPerfTest({bool needsMeasureCpuGpu = false}) {
67-
return PerfTest(
68-
'${flutterDirectory.path}/dev/benchmarks/macrobenchmarks',
69-
'test_driver/simple_animation_perf.dart',
70-
'simple_animation_perf',
71-
needsMeasureCpuGPu: needsMeasureCpuGpu,
7262
).run;
7363
}
7464

@@ -178,18 +168,12 @@ class StartupTest {
178168
/// Measures application runtime performance, specifically per-frame
179169
/// performance.
180170
class PerfTest {
181-
const PerfTest(
182-
this.testDirectory,
183-
this.testTarget,
184-
this.timelineFileName,
185-
{this.needsMeasureCpuGPu = false});
171+
const PerfTest(this.testDirectory, this.testTarget, this.timelineFileName);
186172

187173
final String testDirectory;
188174
final String testTarget;
189175
final String timelineFileName;
190176

191-
final bool needsMeasureCpuGPu;
192-
193177
Future<TaskResult> run() {
194178
return inDirectory<TaskResult>(testDirectory, () async {
195179
final Device device = await devices.workingDevice;
@@ -218,12 +202,6 @@ class PerfTest {
218202
);
219203
}
220204

221-
if (needsMeasureCpuGPu) {
222-
await inDirectory<void>('$testDirectory/build', () async {
223-
data.addAll(await measureIosCpuGpu(deviceId: deviceId));
224-
});
225-
}
226-
227205
return TaskResult.success(data, benchmarkScoreKeys: <String>[
228206
'average_frame_build_time_millis',
229207
'worst_frame_build_time_millis',
@@ -235,8 +213,6 @@ class PerfTest {
235213
'missed_frame_rasterizer_budget_count',
236214
'90th_percentile_frame_rasterizer_time_millis',
237215
'99th_percentile_frame_rasterizer_time_millis',
238-
if (needsMeasureCpuGPu) 'cpu_percentage',
239-
if (needsMeasureCpuGPu) 'gpu_percentage',
240216
]);
241217
});
242218
}

0 commit comments

Comments
 (0)