Commit d869c010 authored by Ian Hickson's avatar Ian Hickson

Merge pull request #1181 from Hixie/stats-box-rename

Rename StatisticsOverlay to PerformanceOverlay.
parents b6f3b298 88c43c3f
......@@ -42,7 +42,7 @@ class StocksAppState extends State<StocksApp> {
backupMode: BackupMode.enabled,
debugShowGrid: false,
debugShowSizes: false,
showRenderingStatistics: false
showPerformanceOverlay: false
);
void initState() {
......@@ -108,7 +108,7 @@ class StocksAppState extends State<StocksApp> {
title: 'Stocks',
theme: theme,
debugShowMaterialGrid: _configuration.debugShowGrid,
showRenderingPerformanceOverlay: _configuration.showRenderingStatistics,
showPerformanceOverlay: _configuration.showPerformanceOverlay,
routes: <String, RouteBuilder>{
'/': (RouteArguments args) => new StockHome(_stocks, _symbols, _configuration, configurationUpdater),
'/settings': (RouteArguments args) => new StockSettings(_configuration, configurationUpdater)
......
......@@ -31,8 +31,8 @@ class StockSettingsState extends State<StockSettings> {
sendUpdates(config.configuration.copyWith(debugShowSizes: value));
}
void _handleShowRenderingStatisticsChanged(bool value) {
sendUpdates(config.configuration.copyWith(showRenderingStatistics: value));
void _handleShowPerformanceOverlayChanged(bool value) {
sendUpdates(config.configuration.copyWith(showPerformanceOverlay: value));
}
void _confirmOptimismChange() {
......@@ -103,12 +103,12 @@ class StockSettingsState extends State<StockSettings> {
),
new DrawerItem(
icon: 'action/picture_in_picture',
onPressed: () { _handleShowRenderingStatisticsChanged(!config.configuration.showRenderingStatistics); },
onPressed: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); },
child: new Row(<Widget>[
new Flexible(child: new Text('Show rendering performance overlay')),
new Switch(
value: config.configuration.showRenderingStatistics,
onChanged: _handleShowRenderingStatisticsChanged
value: config.configuration.showPerformanceOverlay,
onChanged: _handleShowPerformanceOverlayChanged
),
])
),
......
......@@ -13,34 +13,34 @@ class StockConfiguration {
this.backupMode,
this.debugShowGrid,
this.debugShowSizes,
this.showRenderingStatistics
this.showPerformanceOverlay
}) {
assert(stockMode != null);
assert(backupMode != null);
assert(debugShowGrid != null);
assert(debugShowSizes != null);
assert(showRenderingStatistics != null);
assert(showPerformanceOverlay != null);
}
final StockMode stockMode;
final BackupMode backupMode;
final bool debugShowGrid;
final bool debugShowSizes;
final bool showRenderingStatistics;
final bool showPerformanceOverlay;
StockConfiguration copyWith({
StockMode stockMode,
BackupMode backupMode,
bool debugShowGrid,
bool debugShowSizes,
bool showRenderingStatistics
bool showPerformanceOverlay
}) {
return new StockConfiguration(
stockMode: stockMode ?? this.stockMode,
backupMode: backupMode ?? this.backupMode,
debugShowGrid: debugShowGrid ?? this.debugShowGrid,
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';
export 'src/rendering/object.dart';
export 'src/rendering/overflow.dart';
export 'src/rendering/paragraph.dart';
export 'src/rendering/performance_overlay.dart';
export 'src/rendering/proxy_box.dart';
export 'src/rendering/shifted_box.dart';
export 'src/rendering/stack.dart';
export 'src/rendering/statistics_box.dart';
export 'src/rendering/view.dart';
export 'src/rendering/viewport.dart';
......
......@@ -49,12 +49,12 @@ class MaterialApp extends StatefulComponent {
this.onGenerateRoute,
this.onLocaleChanged,
this.debugShowMaterialGrid: false,
this.showRenderingPerformanceOverlay: false
this.showPerformanceOverlay: false
}) : super(key: key) {
assert(routes != null);
assert(routes.containsKey(Navigator.defaultRouteName) || onGenerateRoute != null);
assert(debugShowMaterialGrid != null);
assert(showRenderingPerformanceOverlay != null);
assert(showPerformanceOverlay != null);
}
final String title;
......@@ -63,7 +63,7 @@ class MaterialApp extends StatefulComponent {
final RouteFactory onGenerateRoute;
final LocaleChangedCallback onLocaleChanged;
final bool debugShowMaterialGrid;
final bool showRenderingPerformanceOverlay;
final bool showPerformanceOverlay;
_MaterialAppState createState() => new _MaterialAppState();
}
......@@ -174,10 +174,10 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver {
}
return true;
});
if (config.showRenderingPerformanceOverlay) {
if (config.showPerformanceOverlay) {
result = new Stack([
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;
......
......@@ -128,9 +128,9 @@ class PictureLayer extends Layer {
}
/// A layer that indicates to the compositor that it should display
/// certain statistics within it
class StatisticsLayer extends Layer {
StatisticsLayer({
/// certain performance statistics within it.
class PerformanceOverlayLayer extends Layer {
PerformanceOverlayLayer({
Offset offset: Offset.zero,
this.paintBounds,
this.optionsMask,
......@@ -147,7 +147,7 @@ class StatisticsLayer extends Layer {
void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
assert(optionsMask != null);
builder.addStatistics(optionsMask, paintBounds.shift(offset + layerOffset));
builder.addPerformanceOverlay(optionsMask, paintBounds.shift(offset + layerOffset));
builder.setRasterizerTracingThreshold(rasterizerThreshold);
}
}
......
......@@ -183,18 +183,18 @@ class PaintingContext {
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.
void pushStatistics(Offset offset, int optionsMask, int rasterizerThreshold, Size size) {
void pushPerformanceOverlay(Offset offset, int optionsMask, int rasterizerThreshold, Size size) {
_stopRecordingIfNeeded();
StatisticsLayer statisticsLayer = new StatisticsLayer(
PerformanceOverlayLayer performanceOverlayLayer = new PerformanceOverlayLayer(
paintBounds: new Rect.fromLTWH(0.0, 0.0, size.width, size.height),
optionsMask: optionsMask,
rasterizerThreshold: rasterizerThreshold
);
_appendLayer(statisticsLayer, offset);
_appendLayer(performanceOverlayLayer, offset);
}
/// Push a rectangular clip rect.
......
......@@ -5,9 +5,12 @@
import 'box.dart';
import 'object.dart';
/// The options that control whether the statistics overlay displays certain
/// aspects of the compositor
enum StatisticsOption {
/// The options that control whether the performance overlay displays certain
/// aspects of the compositor.
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
/// updated every frame.
///
......@@ -16,11 +19,13 @@ enum StatisticsOption {
/// and tries to flush them onto the screen. When the total time taken by this
/// step exceeds the frame slice, a frame is lost.
displayRasterizerStatistics,
/// 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 spent by the rasterizer as a fraction of the total frame slice. When
/// the bar turns red, a frame is lost.
visualizeRasterizerStatistics,
/// Display the frame time and FPS at which the interface can construct a
/// layer tree for the rasterizer (whose behavior is described above) to
/// consume.
......@@ -28,6 +33,7 @@ enum StatisticsOption {
/// This involves all layout, animations, etc. When the total time taken by
/// this step exceeds the frame slice, a frame is lost.
displayEngineStatistics,
/// 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
/// spent by the eninge as a fraction of the total frame slice. When the bar
......@@ -35,13 +41,13 @@ enum StatisticsOption {
visualizeEngineStatistics,
}
class RenderStatisticsBox extends RenderBox {
RenderStatisticsBox({ int optionsMask: 0, int rasterizerThreshold: 0 })
class RenderPerformanceOverlay extends RenderBox {
RenderPerformanceOverlay({ int optionsMask: 0, int rasterizerThreshold: 0 })
: _optionsMask = optionsMask,
_rasterizerThreshold = rasterizerThreshold;
/// The mask is created by shifting 1 by the index of the specific
/// StatisticOption to enable.
/// PerformanceOverlayOption to enable.
int get optionsMask => _optionsMask;
int _optionsMask;
void set optionsMask(int mask) {
......@@ -71,13 +77,13 @@ class RenderStatisticsBox extends RenderBox {
}
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;
if ((optionsMask | (1 << StatisticsOption.displayRasterizerStatistics.index) > 0) ||
(optionsMask | (1 << StatisticsOption.visualizeRasterizerStatistics.index) > 0))
if ((optionsMask | (1 << PerformanceOverlayOption.displayRasterizerStatistics.index) > 0) ||
(optionsMask | (1 << PerformanceOverlayOption.visualizeRasterizerStatistics.index) > 0))
result += kGraphHeight;
if ((optionsMask | (1 << StatisticsOption.displayEngineStatistics.index) > 0) ||
(optionsMask | (1 << StatisticsOption.visualizeEngineStatistics.index) > 0))
if ((optionsMask | (1 << PerformanceOverlayOption.displayEngineStatistics.index) > 0) ||
(optionsMask | (1 << PerformanceOverlayOption.visualizeEngineStatistics.index) > 0))
result += kGraphHeight;
return result;
}
......@@ -95,6 +101,6 @@ class RenderStatisticsBox extends RenderBox {
}
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';
import 'framework.dart';
/// 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
// 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
/// [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
StatisticsOverlay.allEnabled({ Key key, this.rasterizerThreshold: 0 })
/// Create a performance overlay that displays all available statistics
PerformanceOverlay.allEnabled({ Key key, this.rasterizerThreshold: 0 })
: optionsMask = (
1 << StatisticsOption.displayRasterizerStatistics.index |
1 << StatisticsOption.visualizeRasterizerStatistics.index |
1 << StatisticsOption.displayEngineStatistics.index |
1 << StatisticsOption.visualizeEngineStatistics.index
1 << PerformanceOverlayOption.displayRasterizerStatistics.index |
1 << PerformanceOverlayOption.visualizeRasterizerStatistics.index |
1 << PerformanceOverlayOption.displayEngineStatistics.index |
1 << PerformanceOverlayOption.visualizeEngineStatistics.index
),
super(key: key);
......@@ -51,17 +51,17 @@ class StatisticsOverlay extends LeafRenderObjectWidget {
/// the instrumentation available in observatory.
///
/// 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
/// how many frame intervals).
final int rasterizerThreshold;
RenderStatisticsBox createRenderObject() => new RenderStatisticsBox(
RenderPerformanceOverlay createRenderObject() => new RenderPerformanceOverlay(
optionsMask: optionsMask,
rasterizerThreshold: rasterizerThreshold
);
void updateRenderObject(RenderStatisticsBox renderObject, RenderObjectWidget oldWidget) {
void updateRenderObject(RenderPerformanceOverlay renderObject, RenderObjectWidget oldWidget) {
renderObject.optionsMask = optionsMask;
renderObject.rasterizerThreshold = rasterizerThreshold;
}
......
......@@ -27,14 +27,14 @@ export 'src/widgets/navigator.dart';
export 'src/widgets/notification_listener.dart';
export 'src/widgets/overlay.dart';
export 'src/widgets/page_storage.dart';
export 'src/widgets/pages.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/routes.dart';
export 'src/widgets/scrollable.dart';
export 'src/widgets/scrollable_grid.dart';
export 'src/widgets/scrollable_list.dart';
export 'src/widgets/statistics_overlay.dart';
export 'src/widgets/status_transitions.dart';
export 'src/widgets/title.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