Skip to content

Commit 24d57fb

Browse files
sortiecommit-bot@chromium.org
authored andcommitted
[benchmark] Add top level benchmarks directory.
Benchmarks are checked in as benchmarks/<Benchmark>/dart/<Benchmark>.dart. This scheme is compatible with our existing benchmarking infrastructure and will aid migrating the benchmarks with minimal breakage. This change adds an Example benchmark to show how it is done. The benchmarks directory is now added to the Dart benchmarking builds. Change-Id: I25971ba3b219194fa9cfea6b938372d877477e28 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108414 Commit-Queue: Jonas Termansen <[email protected]> Reviewed-by: Daco Harkes <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent 90088a3 commit 24d57fb

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/.project
44
/Makefile
55
/base
6-
/benchmarks
76
/buildtools
87
/ipch
98
/out

.packages

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ args:third_party/pkg/args/lib
1717
async:third_party/pkg/async/lib
1818
async_helper:pkg/async_helper/lib
1919
bazel_worker:third_party/pkg/bazel_worker/lib
20+
benchmark_harness:third_party/pkg/benchmark_harness/lib
2021
boolean_selector:third_party/pkg/boolean_selector/lib
2122
build_integration:pkg/build_integration/lib
2223
charcode:third_party/pkg/charcode/lib

DEPS

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ vars = {
5555
"args_tag": "1.4.4",
5656
"async_tag": "2.0.8",
5757
"bazel_worker_tag": "bazel_worker-v0.1.20",
58+
"benchmark_harness_tag": "81641290dea44c34138a109a37e215482f405f81",
5859
"boolean_selector_tag" : "1.0.4",
5960
"boringssl_gen_rev": "bbf52f18f425e29b1185f2f6753bec02ed8c5880",
6061
"boringssl_rev" : "702e2b6d3831486535e958f262a05c75a5cb312e",
@@ -236,6 +237,9 @@ deps = {
236237
Var("dart_git") + "async.git" + "@" + Var("async_tag"),
237238
Var("dart_root") + "/third_party/pkg/bazel_worker":
238239
Var("dart_git") + "bazel_worker.git" + "@" + Var("bazel_worker_tag"),
240+
Var("dart_root") + "/third_party/pkg/benchmark_harness":
241+
Var("dart_git") + "benchmark_harness.git" + "@" +
242+
Var("benchmark_harness_tag"),
239243
Var("dart_root") + "/third_party/pkg/boolean_selector":
240244
Var("dart_git") + "boolean_selector.git" +
241245
"@" + Var("boolean_selector_tag"),

benchmarks/Example/dart/Example.dart

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:benchmark_harness/benchmark_harness.dart';
6+
7+
class Example extends BenchmarkBase {
8+
const Example() : super("Example");
9+
10+
// The benchmark code.
11+
void run() {}
12+
13+
// Not measured setup code executed prior to the benchmark runs.
14+
void setup() {}
15+
16+
// Not measures teardown code executed after the benchark runs.
17+
void teardown() {}
18+
}
19+
20+
main() {
21+
const Example().report();
22+
}

tools/bots/try_benchmarks.sh

+6
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ for command; do
105105
pkg \
106106
runtime/bin \
107107
runtime/lib \
108+
benchmarks \
108109
|| (rm -f linux-ia32_profile.tar.gz; exit 1)
109110
strip -w \
110111
-K 'kDartVmSnapshotData' \
@@ -188,6 +189,7 @@ for command; do
188189
pkg \
189190
runtime/bin \
190191
runtime/lib \
192+
benchmarks \
191193
|| (rm -f linux-ia32.tar.gz; exit 1)
192194
elif [ "$command" = linux-ia32-benchmark ]; then
193195
rm -rf tmp
@@ -219,6 +221,7 @@ EOF
219221
out/ReleaseIA32/run_vm_tests InitialRSS
220222
out/ReleaseIA32/run_vm_tests GenKernelKernelLoadKernel
221223
out/ReleaseIA32/run_vm_tests KernelServiceCompileAll
224+
out/ReleaseIA32/dart --profile-period=10000 --packages=.packages benchmarks/Example/dart/Example.dart
222225
cd ..
223226
rm -rf tmp
224227
elif [ "$command" = linux-x64-build ] ||
@@ -264,6 +267,7 @@ EOF
264267
pkg \
265268
runtime/bin \
266269
runtime/lib \
270+
benchmarks \
267271
|| (rm -f linux-x64_profile.tar.gz; exit 1)
268272
strip -w \
269273
-K 'kDartVmSnapshotData' \
@@ -366,6 +370,7 @@ EOF
366370
pkg \
367371
runtime/bin \
368372
runtime/lib \
373+
benchmarks \
369374
|| (rm -f linux-x64.tar.gz; exit 1)
370375
elif [ "$command" = linux-x64-benchmark ] ||
371376
[ "$command" = linux-x64-bytecode-benchmark ]; then
@@ -403,6 +408,7 @@ EOF
403408
out/ReleaseX64/run_vm_tests InitialRSS
404409
out/ReleaseX64/run_vm_tests GenKernelKernelLoadKernel
405410
out/ReleaseX64/run_vm_tests KernelServiceCompileAll
411+
out/ReleaseX64/dart --profile-period=10000 --packages=.packages benchmarks/Example/dart/Example.dart
406412
cd ..
407413
rm -rf tmp
408414
else

0 commit comments

Comments
 (0)