SceneBuilderRecorder class abstract

A recorder for benchmarking interactions with the engine without the framework by directly exercising SceneBuilder.

To implement a benchmark, extend this class and implement onDrawFrame.

Example:

class BenchDrawCircle extends SceneBuilderRecorder {
  BenchDrawCircle() : super(name: benchmarkName);

  static const String benchmarkName = 'draw_circle';

  @override
  void onDrawFrame(SceneBuilder sceneBuilder) {
    final PictureRecorder pictureRecorder = PictureRecorder();
    final Canvas canvas = Canvas(pictureRecorder);
    final Paint paint = Paint()..color = const Color.fromARGB(255, 255, 0, 0);
    final Size windowSize = window.physicalSize;
    canvas.drawCircle(windowSize.center(Offset.zero), 50.0, paint);
    final Picture picture = pictureRecorder.endRecording();
    sceneBuilder.addPicture(picture);
  }
}
Inheritance

Constructors

SceneBuilderRecorder({required String name})
Creates a SceneBuilder benchmark recorder.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isTracingEnabled → bool
Whether this recorder requires tracing using Chrome's DevTools Protocol's "Tracing" API.
finalinherited
name → String
The name of the benchmark.
finalinherited
profile → Profile
Returns the recorded profile.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onBeginFrame() → void
Called from Window.onBeginFrame.
onDrawFrame(SceneBuilder sceneBuilder) → void
Called on every frame.
run() → Future<Profile>
The implementation of the benchmark that will produce a Profile.
override
setUpAll() → Future<void>
Called once before all runs of this benchmark recorder.
inherited
shouldContinue() → bool
Whether the benchmark should continue running.
inherited
tearDownAll() → Future<void>
Called once after all runs of this benchmark recorder.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited