Commit 88c43c3f authored by Ian Hickson's avatar Ian Hickson

Rename StatisticsOverlay to PerformanceOverlay.

parent e20ef502
...@@ -42,7 +42,7 @@ class StocksAppState extends State<StocksApp> { ...@@ -42,7 +42,7 @@ class StocksAppState extends State<StocksApp> {
backupMode: BackupMode.enabled, backupMode: BackupMode.enabled,
debugShowGrid: false, debugShowGrid: false,
debugShowSizes: false, debugShowSizes: false,
showRenderingStatistics: false showPerformanceOverlay: false
); );
void initState() { void initState() {
...@@ -108,7 +108,7 @@ class StocksAppState extends State<StocksApp> { ...@@ -108,7 +108,7 @@ class StocksAppState extends State<StocksApp> {
title: 'Stocks', title: 'Stocks',
theme: theme, theme: theme,
debugShowMaterialGrid: _configuration.debugShowGrid, debugShowMaterialGrid: _configuration.debugShowGrid,
showRenderingPerformanceOverlay: _configuration.showRenderingStatistics, showPerformanceOverlay: _configuration.showPerformanceOverlay,
routes: <String, RouteBuilder>{ routes: <String, RouteBuilder>{
'/': (RouteArguments args) => new StockHome(_stocks, _symbols, _configuration, configurationUpdater), '/': (RouteArguments args) => new StockHome(_stocks, _symbols, _configuration, configurationUpdater),
'/settings': (RouteArguments args) => new StockSettings(_configuration, configurationUpdater) '/settings': (RouteArguments args) => new StockSettings(_configuration, configurationUpdater)
......
...@@ -31,8 +31,8 @@ class StockSettingsState extends State<StockSettings> { ...@@ -31,8 +31,8 @@ class StockSettingsState extends State<StockSettings> {
sendUpdates(config.configuration.copyWith(debugShowSizes: value)); sendUpdates(config.configuration.copyWith(debugShowSizes: value));
} }
void _handleShowRenderingStatisticsChanged(bool value) { void _handleShowPerformanceOverlayChanged(bool value) {
sendUpdates(config.configuration.copyWith(showRenderingStatistics: value)); sendUpdates(config.configuration.copyWith(showPerformanceOverlay: value));
} }
void _confirmOptimismChange() { void _confirmOptimismChange() {
...@@ -103,12 +103,12 @@ class StockSettingsState extends State<StockSettings> { ...@@ -103,12 +103,12 @@ class StockSettingsState extends State<StockSettings> {
), ),
new DrawerItem( new DrawerItem(
icon: 'action/picture_in_picture', icon: 'action/picture_in_picture',
onPressed: () { _handleShowRenderingStatisticsChanged(!config.configuration.showRenderingStatistics); }, onPressed: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); },
child: new Row(<Widget>[ child: new Row(<Widget>[
new Flexible(child: new Text('Show rendering performance overlay')), new Flexible(child: new Text('Show rendering performance overlay')),
new Switch( new Switch(
value: config.configuration.showRenderingStatistics, value: config.configuration.showPerformanceOverlay,
onChanged: _handleShowRenderingStatisticsChanged onChanged: _handleShowPerformanceOverlayChanged
), ),
]) ])
), ),
......
...@@ -13,34 +13,34 @@ class StockConfiguration { ...@@ -13,34 +13,34 @@ class StockConfiguration {
this.backupMode, this.backupMode,
this.debugShowGrid, this.debugShowGrid,
this.debugShowSizes, this.debugShowSizes,
this.showRenderingStatistics this.showPerformanceOverlay
}) { }) {
assert(stockMode != null); assert(stockMode != null);
assert(backupMode != null); assert(backupMode != null);
assert(debugShowGrid != null); assert(debugShowGrid != null);
assert(debugShowSizes != null); assert(debugShowSizes != null);
assert(showRenderingStatistics != null); assert(showPerformanceOverlay != null);
} }
final StockMode stockMode; final StockMode stockMode;
final BackupMode backupMode; final BackupMode backupMode;
final bool debugShowGrid; final bool debugShowGrid;
final bool debugShowSizes; final bool debugShowSizes;
final bool showRenderingStatistics; final bool showPerformanceOverlay;
StockConfiguration copyWith({ StockConfiguration copyWith({
StockMode stockMode, StockMode stockMode,
BackupMode backupMode, BackupMode backupMode,
bool debugShowGrid, bool debugShowGrid,
bool debugShowSizes, bool debugShowSizes,
bool showRenderingStatistics bool showPerformanceOverlay
}) { }) {
return new StockConfiguration( return new StockConfiguration(
stockMode: stockMode ?? this.stockMode, stockMode: stockMode ?? this.stockMode,
backupMode: backupMode ?? this.backupMode, backupMode: backupMode ?? this.backupMode,
debugShowGrid: debugShowGrid ?? this.debugShowGrid, debugShowGrid: debugShowGrid ?? this.debugShowGrid,
debugShowSizes: debugShowSizes ?? this.debugShowSizes, debugShowSizes: debugShowSizes ?? this.debugShowSizes,
showRenderingStatistics: showRenderingStatistics ?? this.showRenderingStatistics showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay
); );
} }
} }
\ No newline at end of file
...@@ -23,10 +23,10 @@ export 'src/rendering/node.dart'; ...@@ -23,10 +23,10 @@ export 'src/rendering/node.dart';
export 'src/rendering/object.dart'; export 'src/rendering/object.dart';
export 'src/rendering/overflow.dart'; export 'src/rendering/overflow.dart';
export 'src/rendering/paragraph.dart'; export 'src/rendering/paragraph.dart';
export 'src/rendering/performance_overlay.dart';
export 'src/rendering/proxy_box.dart'; export 'src/rendering/proxy_box.dart';
export 'src/rendering/shifted_box.dart'; export 'src/rendering/shifted_box.dart';
export 'src/rendering/stack.dart'; export 'src/rendering/stack.dart';
export 'src/rendering/statistics_box.dart';
export 'src/rendering/view.dart'; export 'src/rendering/view.dart';
export 'src/rendering/viewport.dart'; export 'src/rendering/viewport.dart';
......
...@@ -49,12 +49,12 @@ class MaterialApp extends StatefulComponent { ...@@ -49,12 +49,12 @@ class MaterialApp extends StatefulComponent {
this.onGenerateRoute, this.onGenerateRoute,
this.onLocaleChanged, this.onLocaleChanged,
this.debugShowMaterialGrid: false, this.debugShowMaterialGrid: false,
this.showRenderingPerformanceOverlay: false this.showPerformanceOverlay: false
}) : super(key: key) { }) : super(key: key) {
assert(routes != null); assert(routes != null);
assert(routes.containsKey(Navigator.defaultRouteName) || onGenerateRoute != null); assert(routes.containsKey(Navigator.defaultRouteName) || onGenerateRoute != null);
assert(debugShowMaterialGrid != null); assert(debugShowMaterialGrid != null);
assert(showRenderingPerformanceOverlay != null); assert(showPerformanceOverlay != null);
} }
final String title; final String title;
...@@ -63,7 +63,7 @@ class MaterialApp extends StatefulComponent { ...@@ -63,7 +63,7 @@ class MaterialApp extends StatefulComponent {
final RouteFactory onGenerateRoute; final RouteFactory onGenerateRoute;
final LocaleChangedCallback onLocaleChanged; final LocaleChangedCallback onLocaleChanged;
final bool debugShowMaterialGrid; final bool debugShowMaterialGrid;
final bool showRenderingPerformanceOverlay; final bool showPerformanceOverlay;
_MaterialAppState createState() => new _MaterialAppState(); _MaterialAppState createState() => new _MaterialAppState();
} }
...@@ -174,10 +174,10 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver { ...@@ -174,10 +174,10 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver {
} }
return true; return true;
}); });
if (config.showRenderingPerformanceOverlay) { if (config.showPerformanceOverlay) {
result = new Stack([ result = new Stack([
result, result,
new Positioned(bottom: 0.0, left: 0.0, right: 0.0, child: new StatisticsOverlay.allEnabled()), new Positioned(bottom: 0.0, left: 0.0, right: 0.0, child: new PerformanceOverlay.allEnabled()),
]); ]);
} }
return result; return result;
......
...@@ -128,9 +128,9 @@ class PictureLayer extends Layer { ...@@ -128,9 +128,9 @@ class PictureLayer extends Layer {
} }
/// A layer that indicates to the compositor that it should display /// A layer that indicates to the compositor that it should display
/// certain statistics within it /// certain performance statistics within it.
class StatisticsLayer extends Layer { class PerformanceOverlayLayer extends Layer {
StatisticsLayer({ PerformanceOverlayLayer({
Offset offset: Offset.zero, Offset offset: Offset.zero,
this.paintBounds, this.paintBounds,
this.optionsMask, this.optionsMask,
...@@ -147,7 +147,7 @@ class StatisticsLayer extends Layer { ...@@ -147,7 +147,7 @@ class StatisticsLayer extends Layer {
void addToScene(ui.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
assert(optionsMask != null); assert(optionsMask != null);
builder.addStatistics(optionsMask, paintBounds.shift(offset + layerOffset)); builder.addPerformanceOverlay(optionsMask, paintBounds.shift(offset + layerOffset));
builder.setRasterizerTracingThreshold(rasterizerThreshold); builder.setRasterizerTracingThreshold(rasterizerThreshold);
} }
} }
......
...@@ -183,18 +183,18 @@ class PaintingContext { ...@@ -183,18 +183,18 @@ class PaintingContext {
static final Paint _disableAntialias = new Paint()..isAntiAlias = false; static final Paint _disableAntialias = new Paint()..isAntiAlias = false;
/// Push a statistics overlay. /// Push a performance overlay.
/// ///
/// Statistics overlays are always composited because they're drawn by the /// Performance overlays are always composited because they're drawn by the
/// compositor. /// compositor.
void pushStatistics(Offset offset, int optionsMask, int rasterizerThreshold, Size size) { void pushPerformanceOverlay(Offset offset, int optionsMask, int rasterizerThreshold, Size size) {
_stopRecordingIfNeeded(); _stopRecordingIfNeeded();
StatisticsLayer statisticsLayer = new StatisticsLayer( PerformanceOverlayLayer performanceOverlayLayer = new PerformanceOverlayLayer(
paintBounds: new Rect.fromLTWH(0.0, 0.0, size.width, size.height), paintBounds: new Rect.fromLTWH(0.0, 0.0, size.width, size.height),
optionsMask: optionsMask, optionsMask: optionsMask,
rasterizerThreshold: rasterizerThreshold rasterizerThreshold: rasterizerThreshold
); );
_appendLayer(statisticsLayer, offset); _appendLayer(performanceOverlayLayer, offset);
} }
/// Push a rectangular clip rect. /// Push a rectangular clip rect.
......
...@@ -5,9 +5,12 @@ ...@@ -5,9 +5,12 @@
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
/// The options that control whether the statistics overlay displays certain /// The options that control whether the performance overlay displays certain
/// aspects of the compositor /// aspects of the compositor.
enum StatisticsOption { enum PerformanceOverlayOption {
// these must be in the order needed for their index values to match the
// constants in //engine/src/sky/compositor/performance_overlay_layer.h
/// Display the frame time and FPS of the last frame rendered. This field is /// Display the frame time and FPS of the last frame rendered. This field is
/// updated every frame. /// updated every frame.
/// ///
...@@ -16,11 +19,13 @@ enum StatisticsOption { ...@@ -16,11 +19,13 @@ enum StatisticsOption {
/// and tries to flush them onto the screen. When the total time taken by this /// and tries to flush them onto the screen. When the total time taken by this
/// step exceeds the frame slice, a frame is lost. /// step exceeds the frame slice, a frame is lost.
displayRasterizerStatistics, displayRasterizerStatistics,
/// Display the rasterizer frame times as they change over a set period of /// Display the rasterizer frame times as they change over a set period of
/// time in the form of a graph. The y axis of the graph denotes the total /// time in the form of a graph. The y axis of the graph denotes the total
/// time spent by the rasterizer as a fraction of the total frame slice. When /// time spent by the rasterizer as a fraction of the total frame slice. When
/// the bar turns red, a frame is lost. /// the bar turns red, a frame is lost.
visualizeRasterizerStatistics, visualizeRasterizerStatistics,
/// Display the frame time and FPS at which the interface can construct a /// Display the frame time and FPS at which the interface can construct a
/// layer tree for the rasterizer (whose behavior is described above) to /// layer tree for the rasterizer (whose behavior is described above) to
/// consume. /// consume.
...@@ -28,6 +33,7 @@ enum StatisticsOption { ...@@ -28,6 +33,7 @@ enum StatisticsOption {
/// This involves all layout, animations, etc. When the total time taken by /// This involves all layout, animations, etc. When the total time taken by
/// this step exceeds the frame slice, a frame is lost. /// this step exceeds the frame slice, a frame is lost.
displayEngineStatistics, displayEngineStatistics,
/// Display the engine frame times as they change over a set period of time /// Display the engine frame times as they change over a set period of time
/// in the form of a graph. The y axis of the graph denotes the total time /// in the form of a graph. The y axis of the graph denotes the total time
/// spent by the eninge as a fraction of the total frame slice. When the bar /// spent by the eninge as a fraction of the total frame slice. When the bar
...@@ -35,13 +41,13 @@ enum StatisticsOption { ...@@ -35,13 +41,13 @@ enum StatisticsOption {
visualizeEngineStatistics, visualizeEngineStatistics,
} }
class RenderStatisticsBox extends RenderBox { class RenderPerformanceOverlay extends RenderBox {
RenderStatisticsBox({ int optionsMask: 0, int rasterizerThreshold: 0 }) RenderPerformanceOverlay({ int optionsMask: 0, int rasterizerThreshold: 0 })
: _optionsMask = optionsMask, : _optionsMask = optionsMask,
_rasterizerThreshold = rasterizerThreshold; _rasterizerThreshold = rasterizerThreshold;
/// The mask is created by shifting 1 by the index of the specific /// The mask is created by shifting 1 by the index of the specific
/// StatisticOption to enable. /// PerformanceOverlayOption to enable.
int get optionsMask => _optionsMask; int get optionsMask => _optionsMask;
int _optionsMask; int _optionsMask;
void set optionsMask(int mask) { void set optionsMask(int mask) {
...@@ -71,13 +77,13 @@ class RenderStatisticsBox extends RenderBox { ...@@ -71,13 +77,13 @@ class RenderStatisticsBox extends RenderBox {
} }
double get intrinsicHeight { double get intrinsicHeight {
const double kGraphHeight = 80.0; // must match value in statistics_layer.cc const double kGraphHeight = 80.0; // must match value in performance_overlay_layer.cc
double result = 0.0; double result = 0.0;
if ((optionsMask | (1 << StatisticsOption.displayRasterizerStatistics.index) > 0) || if ((optionsMask | (1 << PerformanceOverlayOption.displayRasterizerStatistics.index) > 0) ||
(optionsMask | (1 << StatisticsOption.visualizeRasterizerStatistics.index) > 0)) (optionsMask | (1 << PerformanceOverlayOption.visualizeRasterizerStatistics.index) > 0))
result += kGraphHeight; result += kGraphHeight;
if ((optionsMask | (1 << StatisticsOption.displayEngineStatistics.index) > 0) || if ((optionsMask | (1 << PerformanceOverlayOption.displayEngineStatistics.index) > 0) ||
(optionsMask | (1 << StatisticsOption.visualizeEngineStatistics.index) > 0)) (optionsMask | (1 << PerformanceOverlayOption.visualizeEngineStatistics.index) > 0))
result += kGraphHeight; result += kGraphHeight;
return result; return result;
} }
...@@ -95,6 +101,6 @@ class RenderStatisticsBox extends RenderBox { ...@@ -95,6 +101,6 @@ class RenderStatisticsBox extends RenderBox {
} }
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
context.pushStatistics(offset, optionsMask, rasterizerThreshold, size); context.pushPerformanceOverlay(offset, optionsMask, rasterizerThreshold, size);
} }
} }
...@@ -7,22 +7,22 @@ import 'package:flutter/rendering.dart'; ...@@ -7,22 +7,22 @@ import 'package:flutter/rendering.dart';
import 'framework.dart'; import 'framework.dart';
/// Displays performance statistics. /// Displays performance statistics.
class StatisticsOverlay extends LeafRenderObjectWidget { class PerformanceOverlay extends LeafRenderObjectWidget {
// TODO(abarth): We should have a page on the web site with a screenshot and // TODO(abarth): We should have a page on the web site with a screenshot and
// an explanation of all the various readouts. // an explanation of all the various readouts.
/// Create a statistics overlay that only displays specific statistics. The /// Create a performance overlay that only displays specific statistics. The
/// mask is created by shifting 1 by the index of the specific /// mask is created by shifting 1 by the index of the specific
/// [StatisticOption] to enable. /// [StatisticOption] to enable.
StatisticsOverlay({ this.optionsMask, this.rasterizerThreshold: 0, Key key }) : super(key: key); PerformanceOverlay({ this.optionsMask, this.rasterizerThreshold: 0, Key key }) : super(key: key);
/// Create a statistics overaly that displays all available statistics /// Create a performance overlay that displays all available statistics
StatisticsOverlay.allEnabled({ Key key, this.rasterizerThreshold: 0 }) PerformanceOverlay.allEnabled({ Key key, this.rasterizerThreshold: 0 })
: optionsMask = ( : optionsMask = (
1 << StatisticsOption.displayRasterizerStatistics.index | 1 << PerformanceOverlayOption.displayRasterizerStatistics.index |
1 << StatisticsOption.visualizeRasterizerStatistics.index | 1 << PerformanceOverlayOption.visualizeRasterizerStatistics.index |
1 << StatisticsOption.displayEngineStatistics.index | 1 << PerformanceOverlayOption.displayEngineStatistics.index |
1 << StatisticsOption.visualizeEngineStatistics.index 1 << PerformanceOverlayOption.visualizeEngineStatistics.index
), ),
super(key: key); super(key: key);
...@@ -51,17 +51,17 @@ class StatisticsOverlay extends LeafRenderObjectWidget { ...@@ -51,17 +51,17 @@ class StatisticsOverlay extends LeafRenderObjectWidget {
/// the instrumentation available in observatory. /// the instrumentation available in observatory.
/// ///
/// To decide what threshold interval to use, count the number of horizontal /// To decide what threshold interval to use, count the number of horizontal
/// lines displayed in the statistics overlay for the rasterizer (not the /// lines displayed in the performance overlay for the rasterizer (not the
/// engine). That should give an idea of how often frames are skipped (and by /// engine). That should give an idea of how often frames are skipped (and by
/// how many frame intervals). /// how many frame intervals).
final int rasterizerThreshold; final int rasterizerThreshold;
RenderStatisticsBox createRenderObject() => new RenderStatisticsBox( RenderPerformanceOverlay createRenderObject() => new RenderPerformanceOverlay(
optionsMask: optionsMask, optionsMask: optionsMask,
rasterizerThreshold: rasterizerThreshold rasterizerThreshold: rasterizerThreshold
); );
void updateRenderObject(RenderStatisticsBox renderObject, RenderObjectWidget oldWidget) { void updateRenderObject(RenderPerformanceOverlay renderObject, RenderObjectWidget oldWidget) {
renderObject.optionsMask = optionsMask; renderObject.optionsMask = optionsMask;
renderObject.rasterizerThreshold = rasterizerThreshold; renderObject.rasterizerThreshold = rasterizerThreshold;
} }
......
...@@ -27,14 +27,14 @@ export 'src/widgets/navigator.dart'; ...@@ -27,14 +27,14 @@ export 'src/widgets/navigator.dart';
export 'src/widgets/notification_listener.dart'; export 'src/widgets/notification_listener.dart';
export 'src/widgets/overlay.dart'; export 'src/widgets/overlay.dart';
export 'src/widgets/page_storage.dart'; export 'src/widgets/page_storage.dart';
export 'src/widgets/pages.dart';
export 'src/widgets/pageable_list.dart'; export 'src/widgets/pageable_list.dart';
export 'src/widgets/pages.dart';
export 'src/widgets/performance_overlay.dart';
export 'src/widgets/placeholder.dart'; export 'src/widgets/placeholder.dart';
export 'src/widgets/routes.dart'; export 'src/widgets/routes.dart';
export 'src/widgets/scrollable.dart'; export 'src/widgets/scrollable.dart';
export 'src/widgets/scrollable_grid.dart'; export 'src/widgets/scrollable_grid.dart';
export 'src/widgets/scrollable_list.dart'; export 'src/widgets/scrollable_list.dart';
export 'src/widgets/statistics_overlay.dart';
export 'src/widgets/status_transitions.dart'; export 'src/widgets/status_transitions.dart';
export 'src/widgets/title.dart'; export 'src/widgets/title.dart';
export 'src/widgets/transitions.dart'; export 'src/widgets/transitions.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment