Skip to content

Commit 102cd01

Browse files
[flutter_tools] remove raster stats CLI option. (flutter#152501)
The raster stats feature is being removed from devtools and the engine. Remove the CLI option as well. Fixes flutter#144191 Fixes flutter#132169
1 parent 53c732f commit 102cd01

File tree

8 files changed

+0
-162
lines changed

8 files changed

+0
-162
lines changed

packages/flutter_tools/lib/src/base/command_help.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,6 @@ class CommandHelp {
124124
'WidgetsApp.showWidgetInspectorOverride',
125125
);
126126

127-
late final CommandHelpOption j = _makeOption(
128-
'j',
129-
'Dump frame raster stats for the current frame. (Unsupported for web)',
130-
);
131-
132127
late final CommandHelpOption k = _makeOption(
133128
'k',
134129
'Toggle CanvasKit rendering.',

packages/flutter_tools/lib/src/resident_runner.dart

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -694,52 +694,6 @@ abstract class ResidentHandlers {
694694
return true;
695695
}
696696

697-
/// Dump frame rasterization metrics for the last rendered frame.
698-
///
699-
/// The last frames gets re-painted while recording additional tracing info
700-
/// pertaining to the various draw calls issued by the frame. The timings
701-
/// recorded here are not indicative of production performance. The intended
702-
/// use case is to look at the various layers in proportion to see what
703-
/// contributes the most towards raster performance.
704-
Future<bool> debugFrameJankMetrics() async {
705-
if (!supportsServiceProtocol) {
706-
return false;
707-
}
708-
for (final FlutterDevice? device in flutterDevices) {
709-
if (device?.targetPlatform == TargetPlatform.web_javascript) {
710-
logger.printWarning('Unable to get jank metrics for web');
711-
continue;
712-
}
713-
final List<FlutterView> views = await device!.vmService!.getFlutterViews();
714-
try {
715-
for (final FlutterView view in views) {
716-
final Map<String, Object?>? rasterData =
717-
await device.vmService!.renderFrameWithRasterStats(
718-
viewId: view.id,
719-
uiIsolateId: view.uiIsolate!.id,
720-
);
721-
if (rasterData != null) {
722-
final File tempFile = globals.fsUtils.getUniqueFile(
723-
globals.fs.currentDirectory,
724-
'flutter_jank_metrics',
725-
'json',
726-
);
727-
tempFile.writeAsStringSync(jsonEncode(rasterData), flush: true);
728-
logger.printStatus('Wrote jank metrics to ${tempFile.absolute.path}');
729-
} else {
730-
logger.printWarning('Unable to get jank metrics.');
731-
}
732-
}
733-
} on vm_service.RPCError catch (err) {
734-
if (err.code != RPCErrorCodes.kServerError || !err.message.contains('Raster status not supported on Impeller backend')) {
735-
rethrow;
736-
}
737-
logger.printWarning('Unable to get jank metrics for Impeller renderer');
738-
}
739-
}
740-
return true;
741-
}
742-
743697
/// Dump the application's current layer tree to the terminal.
744698
Future<bool> debugDumpLayerTree() async {
745699
if (!supportsServiceProtocol || !isRunningDebug) {
@@ -1558,7 +1512,6 @@ abstract class ResidentRunner extends ResidentHandlers {
15581512
if (isRunningDebug) {
15591513
commandHelp.g.print();
15601514
}
1561-
commandHelp.j.print();
15621515
}
15631516
}
15641517

@@ -1739,9 +1692,6 @@ class TerminalHandler {
17391692
return residentRunner.debugToggleWidgetInspector();
17401693
case 'I':
17411694
return residentRunner.debugToggleInvertOversizedImages();
1742-
case 'j':
1743-
case 'J':
1744-
return residentRunner.debugFrameJankMetrics();
17451695
case 'L':
17461696
return residentRunner.debugDumpLayerTree();
17471697
case 'o':

packages/flutter_tools/lib/src/vmservice.dart

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const String kFlushUIThreadTasksMethod = '_flutter.flushUIThreadTasks';
2828
const String kRunInViewMethod = '_flutter.runInView';
2929
const String kListViewsMethod = '_flutter.listViews';
3030
const String kScreenshotSkpMethod = '_flutter.screenshotSkp';
31-
const String kRenderFrameWithRasterStatsMethod = '_flutter.renderFrameWithRasterStats';
3231
const String kReloadAssetFonts = '_flutter.reloadAssetFonts';
3332

3433
const String kFlutterToolAlias = 'Flutter Tools';
@@ -593,26 +592,6 @@ class FlutterVmService {
593592
await onRunnable;
594593
}
595594

596-
/// Renders the last frame with additional raster tracing enabled.
597-
///
598-
/// When a frame is rendered using this method it will incur additional cost
599-
/// for rasterization which is not reflective of how long the frame takes in
600-
/// production. This is primarily intended to be used to identify the layers
601-
/// that result in the most raster perf degradation.
602-
Future<Map<String, Object?>?> renderFrameWithRasterStats({
603-
required String? viewId,
604-
required String? uiIsolateId,
605-
}) async {
606-
final vm_service.Response? response = await callMethodWrapper(
607-
kRenderFrameWithRasterStatsMethod,
608-
isolateId: uiIsolateId,
609-
args: <String, String?>{
610-
'viewId': viewId,
611-
},
612-
);
613-
return response?.json;
614-
}
615-
616595
Future<String> flutterDebugDumpApp({
617596
required String isolateId,
618597
}) async {

packages/flutter_tools/test/general.shard/resident_runner_helpers.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,6 @@ final FakeVmServiceRequest listViews = FakeVmServiceRequest(
113113
},
114114
);
115115

116-
const FakeVmServiceRequest renderFrameRasterStats = FakeVmServiceRequest(
117-
method: kRenderFrameWithRasterStatsMethod,
118-
args: <String, Object>{
119-
'viewId': 'a',
120-
'isolateId': '1',
121-
},
122-
error: FakeRPCError(
123-
code: RPCErrorCodes.kServerError,
124-
error: 'Raster status not supported on Impeller backend',
125-
),
126-
);
127-
128116
const FakeVmServiceRequest setAssetBundlePath = FakeVmServiceRequest(
129117
method: '_flutter.setAssetBundlePath',
130118
args: <String, Object>{

packages/flutter_tools/test/general.shard/resident_runner_test.dart

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -326,31 +326,6 @@ void main() {
326326
Usage: () => TestUsage(),
327327
}));
328328

329-
testUsingContext('ResidentRunner can handle an RPC exception from debugFrameJankMetrics', () => testbed.run(() async {
330-
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
331-
listViews,
332-
listViews,
333-
listViews,
334-
renderFrameRasterStats,
335-
]);
336-
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
337-
final Completer<void> futureAppStart = Completer<void>.sync();
338-
unawaited(residentRunner.attach(
339-
appStartedCompleter: futureAppStart,
340-
connectionInfoCompleter: futureConnectionInfo,
341-
));
342-
await futureAppStart.future;
343-
344-
final bool result = await residentRunner.debugFrameJankMetrics();
345-
expect(result, true);
346-
expect((globals.flutterUsage as TestUsage).events, isEmpty);
347-
expect(fakeAnalytics.sentEvents, isEmpty);
348-
expect(fakeVmServiceHost?.hasRemainingExpectations, false);
349-
expect((globals.logger as BufferLogger).warningText, contains('Unable to get jank metrics for Impeller renderer'));
350-
}, overrides: <Type, Generator>{
351-
Usage: () => TestUsage(),
352-
}));
353-
354329
testUsingContext('ResidentRunner fails its operation if the device initialization is not complete', () => testbed.run(() async {
355330
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
356331
listViews,
@@ -1335,7 +1310,6 @@ flutter:
13351310
commandHelp.a,
13361311
commandHelp.M,
13371312
commandHelp.g,
1338-
commandHelp.j,
13391313
commandHelp.hWithDetails,
13401314
commandHelp.c,
13411315
commandHelp.q,

packages/flutter_tools/test/general.shard/terminal_handler_test.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ void main() {
179179
await terminalHandler.processTerminalInput('a');
180180
});
181181

182-
testWithoutContext('j unsupported jank metrics for web', () async {
183-
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[], web: true);
184-
await terminalHandler.processTerminalInput('j');
185-
expect(terminalHandler.logger.warningText.contains('Unable to get jank metrics for web'), true);
186-
});
187-
188182
testWithoutContext('a - debugToggleProfileWidgetBuilds without service protocol is skipped', () async {
189183
final TerminalHandler terminalHandler = setUpTerminalHandler(<FakeVmServiceRequest>[], supportsServiceProtocol: false);
190184

packages/flutter_tools/test/general.shard/vmservice_test.dart

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -424,14 +424,6 @@ void main() {
424424
method: 'getVMTimeline',
425425
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
426426
),
427-
const FakeVmServiceRequest(
428-
method: kRenderFrameWithRasterStatsMethod,
429-
args: <String, dynamic>{
430-
'viewId': '1',
431-
'isolateId': '12',
432-
},
433-
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
434-
),
435427
]
436428
);
437429

@@ -452,10 +444,6 @@ void main() {
452444
final vm_service.Response? timeline = await fakeVmServiceHost.vmService.getTimeline();
453445
expect(timeline, isNull);
454446

455-
final Map<String, Object?>? rasterStats =
456-
await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: '1', uiIsolateId: '12');
457-
expect(rasterStats, isNull);
458-
459447
expect(fakeVmServiceHost.hasRemainingExpectations, false);
460448
});
461449

@@ -480,35 +468,6 @@ void main() {
480468
expect(fakeVmServiceHost.hasRemainingExpectations, false);
481469
});
482470

483-
testWithoutContext('renderWithStats forwards stats correctly', () async {
484-
// ignore: always_specify_types
485-
const Map<String, dynamic> response = {
486-
'type': 'RenderFrameWithRasterStats',
487-
'snapshots':<dynamic>[
488-
// ignore: always_specify_types
489-
{
490-
'layer_unique_id':1512,
491-
'duration_micros':477,
492-
'snapshot':'',
493-
},
494-
],
495-
};
496-
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
497-
requests: <VmServiceExpectation>[
498-
const FakeVmServiceRequest(method: kRenderFrameWithRasterStatsMethod, args: <String, Object>{
499-
'isolateId': 'isolate/123',
500-
'viewId': 'view/1',
501-
}, jsonResponse: response),
502-
]
503-
);
504-
505-
final Map<String, Object?>? rasterStats =
506-
await fakeVmServiceHost.vmService.renderFrameWithRasterStats(viewId: 'view/1', uiIsolateId: 'isolate/123');
507-
expect(rasterStats, equals(response));
508-
509-
expect(fakeVmServiceHost.hasRemainingExpectations, false);
510-
});
511-
512471
testWithoutContext('getFlutterViews polls until a view is returned', () async {
513472
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
514473
requests: <VmServiceExpectation>[

packages/flutter_tools/test/integration.shard/overall_experience_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ void main() {
345345
'a Toggle timeline events for all widget build methods. (debugProfileWidgetBuilds)',
346346
'M Write SkSL shaders to a unique file in the project directory.',
347347
'g Run source code generators.',
348-
'j Dump frame raster stats for the current frame. (Unsupported for web)',
349348
'h Repeat this help message.',
350349
'd Detach (terminate "flutter run" but leave application running).',
351350
'c Clear the screen',

0 commit comments

Comments
 (0)