run method
The implementation of the benchmark that will produce a Profile.
Implementation
@override
Future<Profile> run() async {
_runCompleter = Completer<void>();
final Profile localProfile =
profile = Profile(name: name, useCustomWarmUp: useCustomWarmUp);
final _RecordingWidgetsBinding binding =
_RecordingWidgetsBinding.ensureInitialized();
final Widget widget = createWidget();
registerEngineBenchmarkValueListener(kProfilePrerollFrame, (num value) {
localProfile.addDataPoint(
kProfilePrerollFrame,
Duration(microseconds: value.toInt()),
reported: false,
);
});
registerEngineBenchmarkValueListener(kProfileApplyFrame, (num value) {
localProfile.addDataPoint(
kProfileApplyFrame,
Duration(microseconds: value.toInt()),
reported: false,
);
});
binding._beginRecording(this, widget);
try {
await _runCompleter.future;
return localProfile;
} finally {
stopListeningToEngineBenchmarkValues(kProfilePrerollFrame);
stopListeningToEngineBenchmarkValues(kProfileApplyFrame);
}
}