File size: 1,893 Bytes
e08027e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | // Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'recorder.dart';
class BenchWidgetRecorder extends WidgetRecorder {
BenchWidgetRecorder() : super(name: benchmarkName);
static const String benchmarkName = 'bench_widget_recorder';
@override
Widget createWidget() {
// This is intentionally using a simple widget. The benchmark is meant to
// measure the overhead of the harness, so this method should induce as
// little work as possible.
return const SizedBox.expand();
}
}
class BenchWidgetBuildRecorder extends WidgetBuildRecorder {
BenchWidgetBuildRecorder() : super(name: benchmarkName);
static const String benchmarkName = 'bench_widget_build_recorder';
@override
Widget createWidget() {
// This is intentionally using a simple widget. The benchmark is meant to
// measure the overhead of the harness, so this method should induce as
// little work as possible.
return const SizedBox.expand();
}
}
class BenchRawRecorder extends RawRecorder {
BenchRawRecorder() : super(name: benchmarkName);
static const String benchmarkName = 'bench_raw_recorder';
@override
void body(Profile profile) {
profile.record('profile.record', () {
// This is intentionally empty. The benchmark only measures the overhead
// of the harness.
}, reported: true);
}
}
class BenchSceneBuilderRecorder extends SceneBuilderRecorder {
BenchSceneBuilderRecorder() : super(name: benchmarkName);
static const String benchmarkName = 'bench_scene_builder_recorder';
@override
void onDrawFrame(ui.SceneBuilder sceneBuilder) {
// This is intentionally empty. The benchmark only measures the overhead
// of the harness.
}
}
|