Skip to content

Commit db4dfa0

Browse files
authored
Remove obsolete performance analysis tools. (#147663)
We're unlikely to support these reliably going forward.
1 parent 74771f1 commit db4dfa0

File tree

8 files changed

+4
-217
lines changed

8 files changed

+4
-217
lines changed

packages/flutter/lib/src/cupertino/app.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,6 @@ class _CupertinoAppState extends State<CupertinoApp> {
563563
localeListResolutionCallback: widget.localeListResolutionCallback,
564564
supportedLocales: widget.supportedLocales,
565565
showPerformanceOverlay: widget.showPerformanceOverlay,
566-
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
567-
checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers,
568566
showSemanticsDebugger: widget.showSemanticsDebugger,
569567
debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner,
570568
inspectorSelectButtonBuilder: _inspectorSelectButtonBuilder,
@@ -599,8 +597,6 @@ class _CupertinoAppState extends State<CupertinoApp> {
599597
localeListResolutionCallback: widget.localeListResolutionCallback,
600598
supportedLocales: widget.supportedLocales,
601599
showPerformanceOverlay: widget.showPerformanceOverlay,
602-
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
603-
checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers,
604600
showSemanticsDebugger: widget.showSemanticsDebugger,
605601
debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner,
606602
inspectorSelectButtonBuilder: _inspectorSelectButtonBuilder,

packages/flutter/lib/src/material/app.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,6 @@ class _MaterialAppState extends State<MaterialApp> {
10281028
localeListResolutionCallback: widget.localeListResolutionCallback,
10291029
supportedLocales: widget.supportedLocales,
10301030
showPerformanceOverlay: widget.showPerformanceOverlay,
1031-
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
1032-
checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers,
10331031
showSemanticsDebugger: widget.showSemanticsDebugger,
10341032
debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner,
10351033
inspectorSelectButtonBuilder: _inspectorSelectButtonBuilder,
@@ -1064,8 +1062,6 @@ class _MaterialAppState extends State<MaterialApp> {
10641062
localeListResolutionCallback: widget.localeListResolutionCallback,
10651063
supportedLocales: widget.supportedLocales,
10661064
showPerformanceOverlay: widget.showPerformanceOverlay,
1067-
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
1068-
checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers,
10691065
showSemanticsDebugger: widget.showSemanticsDebugger,
10701066
debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner,
10711067
inspectorSelectButtonBuilder: _inspectorSelectButtonBuilder,

packages/flutter/lib/src/rendering/layer.dart

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,9 +1014,6 @@ class PerformanceOverlayLayer extends Layer {
10141014
PerformanceOverlayLayer({
10151015
required Rect overlayRect,
10161016
required this.optionsMask,
1017-
required this.rasterizerThreshold,
1018-
required this.checkerboardRasterCacheImages,
1019-
required this.checkerboardOffscreenLayers,
10201017
}) : _overlayRect = overlayRect;
10211018

10221019
/// The rectangle in this layer's coordinate system that the overlay should occupy.
@@ -1036,40 +1033,9 @@ class PerformanceOverlayLayer extends Layer {
10361033
/// [PerformanceOverlayOption] to enable.
10371034
final int optionsMask;
10381035

1039-
/// The rasterizer threshold is an integer specifying the number of frame
1040-
/// intervals that the rasterizer must miss before it decides that the frame
1041-
/// is suitable for capturing an SkPicture trace for further analysis.
1042-
final int rasterizerThreshold;
1043-
1044-
/// Whether the raster cache should checkerboard cached entries.
1045-
///
1046-
/// The compositor can sometimes decide to cache certain portions of the
1047-
/// widget hierarchy. Such portions typically don't change often from frame to
1048-
/// frame and are expensive to render. This can speed up overall rendering. However,
1049-
/// there is certain upfront cost to constructing these cache entries. And, if
1050-
/// the cache entries are not used very often, this cost may not be worth the
1051-
/// speedup in rendering of subsequent frames. If the developer wants to be certain
1052-
/// that populating the raster cache is not causing stutters, this option can be
1053-
/// set. Depending on the observations made, hints can be provided to the compositor
1054-
/// that aid it in making better decisions about caching.
1055-
final bool checkerboardRasterCacheImages;
1056-
1057-
/// Whether the compositor should checkerboard layers that are rendered to offscreen
1058-
/// bitmaps. This can be useful for debugging rendering performance.
1059-
///
1060-
/// Render target switches are caused by using opacity layers (via a [FadeTransition] or
1061-
/// [Opacity] widget), clips, shader mask layers, etc. Selecting a new render target
1062-
/// and merging it with the rest of the scene has a performance cost. This can sometimes
1063-
/// be avoided by using equivalent widgets that do not require these layers (for example,
1064-
/// replacing an [Opacity] widget with an [widgets.Image] using a [BlendMode]).
1065-
final bool checkerboardOffscreenLayers;
1066-
10671036
@override
10681037
void addToScene(ui.SceneBuilder builder) {
10691038
builder.addPerformanceOverlay(optionsMask, overlayRect);
1070-
builder.setRasterizerTracingThreshold(rasterizerThreshold);
1071-
builder.setCheckerboardRasterCacheImages(checkerboardRasterCacheImages);
1072-
builder.setCheckerboardOffscreenLayers(checkerboardOffscreenLayers);
10731039
}
10741040

10751041
@override

packages/flutter/lib/src/rendering/performance_overlay.dart

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,7 @@ class RenderPerformanceOverlay extends RenderBox {
6363
/// Creates a performance overlay render object.
6464
RenderPerformanceOverlay({
6565
int optionsMask = 0,
66-
int rasterizerThreshold = 0,
67-
bool checkerboardRasterCacheImages = false,
68-
bool checkerboardOffscreenLayers = false,
69-
}) : _optionsMask = optionsMask,
70-
_rasterizerThreshold = rasterizerThreshold,
71-
_checkerboardRasterCacheImages = checkerboardRasterCacheImages,
72-
_checkerboardOffscreenLayers = checkerboardOffscreenLayers;
66+
}) : _optionsMask = optionsMask;
7367

7468
/// The mask is created by shifting 1 by the index of the specific
7569
/// [PerformanceOverlayOption] to enable.
@@ -83,41 +77,6 @@ class RenderPerformanceOverlay extends RenderBox {
8377
markNeedsPaint();
8478
}
8579

86-
/// The rasterizer threshold is an integer specifying the number of frame
87-
/// intervals that the rasterizer must miss before it decides that the frame
88-
/// is suitable for capturing an SkPicture trace for further analysis.
89-
int get rasterizerThreshold => _rasterizerThreshold;
90-
int _rasterizerThreshold;
91-
set rasterizerThreshold(int value) {
92-
if (value == _rasterizerThreshold) {
93-
return;
94-
}
95-
_rasterizerThreshold = value;
96-
markNeedsPaint();
97-
}
98-
99-
/// Whether the raster cache should checkerboard cached entries.
100-
bool get checkerboardRasterCacheImages => _checkerboardRasterCacheImages;
101-
bool _checkerboardRasterCacheImages;
102-
set checkerboardRasterCacheImages(bool value) {
103-
if (value == _checkerboardRasterCacheImages) {
104-
return;
105-
}
106-
_checkerboardRasterCacheImages = value;
107-
markNeedsPaint();
108-
}
109-
110-
/// Whether the compositor should checkerboard layers rendered to offscreen bitmaps.
111-
bool get checkerboardOffscreenLayers => _checkerboardOffscreenLayers;
112-
bool _checkerboardOffscreenLayers;
113-
set checkerboardOffscreenLayers(bool value) {
114-
if (value == _checkerboardOffscreenLayers) {
115-
return;
116-
}
117-
_checkerboardOffscreenLayers = value;
118-
markNeedsPaint();
119-
}
120-
12180
@override
12281
bool get sizedByParent => true;
12382

@@ -170,9 +129,6 @@ class RenderPerformanceOverlay extends RenderBox {
170129
context.addLayer(PerformanceOverlayLayer(
171130
overlayRect: Rect.fromLTWH(offset.dx, offset.dy, size.width, size.height),
172131
optionsMask: optionsMask,
173-
rasterizerThreshold: rasterizerThreshold,
174-
checkerboardRasterCacheImages: checkerboardRasterCacheImages,
175-
checkerboardOffscreenLayers: checkerboardOffscreenLayers,
176132
));
177133
}
178134
}

packages/flutter/lib/src/widgets/app.dart

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,6 @@ class WidgetsApp extends StatefulWidget {
330330
this.localeResolutionCallback,
331331
this.supportedLocales = const <Locale>[Locale('en', 'US')],
332332
this.showPerformanceOverlay = false,
333-
this.checkerboardRasterCacheImages = false,
334-
this.checkerboardOffscreenLayers = false,
335333
this.showSemanticsDebugger = false,
336334
this.debugShowWidgetInspector = false,
337335
this.debugShowCheckedModeBanner = true,
@@ -430,8 +428,6 @@ class WidgetsApp extends StatefulWidget {
430428
this.localeResolutionCallback,
431429
this.supportedLocales = const <Locale>[Locale('en', 'US')],
432430
this.showPerformanceOverlay = false,
433-
this.checkerboardRasterCacheImages = false,
434-
this.checkerboardOffscreenLayers = false,
435431
this.showSemanticsDebugger = false,
436432
this.debugShowWidgetInspector = false,
437433
this.debugShowCheckedModeBanner = true,
@@ -1011,16 +1007,6 @@ class WidgetsApp extends StatefulWidget {
10111007
/// * <https://flutter.dev/debugging/#performance-overlay>
10121008
final bool showPerformanceOverlay;
10131009

1014-
/// Checkerboards raster cache images.
1015-
///
1016-
/// See [PerformanceOverlay.checkerboardRasterCacheImages].
1017-
final bool checkerboardRasterCacheImages;
1018-
1019-
/// Checkerboards layers rendered to offscreen bitmaps.
1020-
///
1021-
/// See [PerformanceOverlay.checkerboardOffscreenLayers].
1022-
final bool checkerboardOffscreenLayers;
1023-
10241010
/// Turns on an overlay that shows the accessibility information
10251011
/// reported by the framework.
10261012
final bool showSemanticsDebugger;
@@ -1740,25 +1726,11 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
17401726
);
17411727
}
17421728

1743-
PerformanceOverlay? performanceOverlay;
1744-
// We need to push a performance overlay if any of the display or checkerboarding
1745-
// options are set.
17461729
if (widget.showPerformanceOverlay || WidgetsApp.showPerformanceOverlayOverride) {
1747-
performanceOverlay = PerformanceOverlay.allEnabled(
1748-
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
1749-
checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers,
1750-
);
1751-
} else if (widget.checkerboardRasterCacheImages || widget.checkerboardOffscreenLayers) {
1752-
performanceOverlay = PerformanceOverlay(
1753-
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
1754-
checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers,
1755-
);
1756-
}
1757-
if (performanceOverlay != null) {
17581730
result = Stack(
17591731
children: <Widget>[
17601732
result,
1761-
Positioned(top: 0.0, left: 0.0, right: 0.0, child: performanceOverlay),
1733+
Positioned(top: 0.0, left: 0.0, right: 0.0, child: PerformanceOverlay.allEnabled()),
17621734
],
17631735
);
17641736
}

packages/flutter/lib/src/widgets/performance_overlay.dart

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,16 @@ import 'framework.dart';
2222
/// [MaterialApp.showPerformanceOverlay] or [WidgetsApp.showPerformanceOverlay]
2323
/// to true.
2424
class PerformanceOverlay extends LeafRenderObjectWidget {
25-
// TODO(abarth): We should have a page on the web site with a screenshot and
26-
// an explanation of all the various readouts.
27-
2825
/// Create a performance overlay that only displays specific statistics. The
2926
/// mask is created by shifting 1 by the index of the specific
3027
/// [PerformanceOverlayOption] to enable.
3128
const PerformanceOverlay({
3229
super.key,
3330
this.optionsMask = 0,
34-
this.rasterizerThreshold = 0,
35-
this.checkerboardRasterCacheImages = false,
36-
this.checkerboardOffscreenLayers = false,
3731
});
3832

3933
/// Create a performance overlay that displays all available statistics.
40-
PerformanceOverlay.allEnabled({
41-
super.key,
42-
this.rasterizerThreshold = 0,
43-
this.checkerboardRasterCacheImages = false,
44-
this.checkerboardOffscreenLayers = false,
45-
}) : optionsMask =
34+
PerformanceOverlay.allEnabled({ super.key }) : optionsMask =
4635
1 << PerformanceOverlayOption.displayRasterizerStatistics.index |
4736
1 << PerformanceOverlayOption.visualizeRasterizerStatistics.index |
4837
1 << PerformanceOverlayOption.displayEngineStatistics.index |
@@ -52,71 +41,13 @@ class PerformanceOverlay extends LeafRenderObjectWidget {
5241
/// [PerformanceOverlayOption] to enable.
5342
final int optionsMask;
5443

55-
/// The rasterizer threshold is an integer specifying the number of frame
56-
/// intervals that the rasterizer must miss before it decides that the frame
57-
/// is suitable for capturing an SkPicture trace for further analysis.
58-
///
59-
/// For example, if you want a trace of all pictures that could not be
60-
/// rendered by the rasterizer within the frame boundary (and hence caused
61-
/// jank), specify 1. Specifying 2 will trace all pictures that took more
62-
/// than 2 frame intervals to render. Adjust this value to only capture
63-
/// the particularly expensive pictures while skipping the others. Specifying
64-
/// 0 disables all capture.
65-
///
66-
/// Captured traces are placed on your device in the application documents
67-
/// directory in this form "trace_<collection_time>.skp". These can
68-
/// be viewed in the Skia debugger.
69-
///
70-
/// Notes:
71-
/// The rasterizer only takes into account the time it took to render
72-
/// the already constructed picture. This include the Skia calls (which is
73-
/// also why an SkPicture trace is generated) but not any of the time spent in
74-
/// dart to construct that picture. To profile that part of your code, use
75-
/// the instrumentation available in observatory.
76-
///
77-
/// To decide what threshold interval to use, count the number of horizontal
78-
/// lines displayed in the performance overlay for the rasterizer (not the
79-
/// engine). That should give an idea of how often frames are skipped (and by
80-
/// how many frame intervals).
81-
final int rasterizerThreshold;
82-
83-
/// Whether the raster cache should checkerboard cached entries.
84-
///
85-
/// The compositor can sometimes decide to cache certain portions of the
86-
/// widget hierarchy. Such portions typically don't change often from frame to
87-
/// frame and are expensive to render. This can speed up overall rendering. However,
88-
/// there is certain upfront cost to constructing these cache entries. And, if
89-
/// the cache entries are not used very often, this cost may not be worth the
90-
/// speedup in rendering of subsequent frames. If the developer wants to be certain
91-
/// that populating the raster cache is not causing stutters, this option can be
92-
/// set. Depending on the observations made, hints can be provided to the compositor
93-
/// that aid it in making better decisions about caching.
94-
final bool checkerboardRasterCacheImages;
95-
96-
/// Whether the compositor should checkerboard layers that are rendered to offscreen
97-
/// bitmaps. This can be useful for debugging rendering performance.
98-
///
99-
/// Render target switches are caused by using opacity layers (via a [FadeTransition] or
100-
/// [Opacity] widget), clips, shader mask layers, etc. Selecting a new render target
101-
/// and merging it with the rest of the scene has a performance cost. This can sometimes
102-
/// be avoided by using equivalent widgets that do not require these layers (for example,
103-
/// replacing an [Opacity] widget with an [widgets.Image] using a [BlendMode]).
104-
final bool checkerboardOffscreenLayers;
105-
10644
@override
10745
RenderPerformanceOverlay createRenderObject(BuildContext context) => RenderPerformanceOverlay(
10846
optionsMask: optionsMask,
109-
rasterizerThreshold: rasterizerThreshold,
110-
checkerboardRasterCacheImages: checkerboardRasterCacheImages,
111-
checkerboardOffscreenLayers: checkerboardOffscreenLayers,
11247
);
11348

11449
@override
11550
void updateRenderObject(BuildContext context, RenderPerformanceOverlay renderObject) {
116-
renderObject
117-
..optionsMask = optionsMask
118-
..rasterizerThreshold = rasterizerThreshold
119-
..checkerboardRasterCacheImages = checkerboardRasterCacheImages
120-
..checkerboardOffscreenLayers = checkerboardOffscreenLayers;
51+
renderObject.optionsMask = optionsMask;
12152
}
12253
}

packages/flutter/test/rendering/layers_test.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,6 @@ void main() {
429429
final PerformanceOverlayLayer layer = PerformanceOverlayLayer(
430430
overlayRect: Rect.zero,
431431
optionsMask: 0,
432-
rasterizerThreshold: 0,
433-
checkerboardRasterCacheImages: false,
434-
checkerboardOffscreenLayers: false,
435432
);
436433
checkNeedsAddToScene(layer, () {
437434
layer.overlayRect = unitRect;

packages/flutter/test/widgets/performance_overlay_test.dart

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'package:flutter/src/rendering/performance_overlay.dart';
65
import 'package:flutter/widgets.dart';
76
import 'package:flutter_test/flutter_test.dart';
87

@@ -11,30 +10,4 @@ void main() {
1110
await tester.pumpWidget(const PerformanceOverlay());
1211
await tester.pumpWidget(PerformanceOverlay.allEnabled());
1312
});
14-
15-
testWidgets('update widget field checkerboardRasterCacheImages',
16-
(WidgetTester tester) async {
17-
await tester.pumpWidget(const PerformanceOverlay());
18-
await tester.pumpWidget(
19-
const PerformanceOverlay(checkerboardRasterCacheImages: true));
20-
final Finder finder = find.byType(PerformanceOverlay);
21-
expect(
22-
tester
23-
.renderObject<RenderPerformanceOverlay>(finder)
24-
.checkerboardRasterCacheImages,
25-
true);
26-
});
27-
28-
testWidgets('update widget field checkerboardOffscreenLayers',
29-
(WidgetTester tester) async {
30-
await tester.pumpWidget(const PerformanceOverlay());
31-
await tester.pumpWidget(
32-
const PerformanceOverlay(checkerboardOffscreenLayers: true));
33-
final Finder finder = find.byType(PerformanceOverlay);
34-
expect(
35-
tester
36-
.renderObject<RenderPerformanceOverlay>(finder)
37-
.checkerboardOffscreenLayers,
38-
true);
39-
});
4013
}

0 commit comments

Comments
 (0)