From 24d57fb745320c575afed7847c5fde89a587735a Mon Sep 17 00:00:00 2001 From: Jonas Termansen Date: Wed, 10 Jul 2019 14:51:14 +0000 Subject: [PATCH] [benchmark] Add top level benchmarks directory. Benchmarks are checked in as benchmarks//dart/.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 Reviewed-by: Daco Harkes Reviewed-by: Martin Kustermann --- .gitignore | 1 - .packages | 1 + DEPS | 4 ++++ benchmarks/Example/dart/Example.dart | 22 ++++++++++++++++++++++ tools/bots/try_benchmarks.sh | 6 ++++++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 benchmarks/Example/dart/Example.dart diff --git a/.gitignore b/.gitignore index 5dee0a9b0a6..e12b18f9706 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ /.project /Makefile /base -/benchmarks /buildtools /ipch /out diff --git a/.packages b/.packages index 80bae2dd22b..3a8b750eaec 100644 --- a/.packages +++ b/.packages @@ -17,6 +17,7 @@ args:third_party/pkg/args/lib async:third_party/pkg/async/lib async_helper:pkg/async_helper/lib bazel_worker:third_party/pkg/bazel_worker/lib +benchmark_harness:third_party/pkg/benchmark_harness/lib boolean_selector:third_party/pkg/boolean_selector/lib build_integration:pkg/build_integration/lib charcode:third_party/pkg/charcode/lib diff --git a/DEPS b/DEPS index a8cda9e99c1..b9f14c91297 100644 --- a/DEPS +++ b/DEPS @@ -55,6 +55,7 @@ vars = { "args_tag": "1.4.4", "async_tag": "2.0.8", "bazel_worker_tag": "bazel_worker-v0.1.20", + "benchmark_harness_tag": "81641290dea44c34138a109a37e215482f405f81", "boolean_selector_tag" : "1.0.4", "boringssl_gen_rev": "bbf52f18f425e29b1185f2f6753bec02ed8c5880", "boringssl_rev" : "702e2b6d3831486535e958f262a05c75a5cb312e", @@ -236,6 +237,9 @@ deps = { Var("dart_git") + "async.git" + "@" + Var("async_tag"), Var("dart_root") + "/third_party/pkg/bazel_worker": Var("dart_git") + "bazel_worker.git" + "@" + Var("bazel_worker_tag"), + Var("dart_root") + "/third_party/pkg/benchmark_harness": + Var("dart_git") + "benchmark_harness.git" + "@" + + Var("benchmark_harness_tag"), Var("dart_root") + "/third_party/pkg/boolean_selector": Var("dart_git") + "boolean_selector.git" + "@" + Var("boolean_selector_tag"), diff --git a/benchmarks/Example/dart/Example.dart b/benchmarks/Example/dart/Example.dart new file mode 100644 index 00000000000..451124bc8ce --- /dev/null +++ b/benchmarks/Example/dart/Example.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:benchmark_harness/benchmark_harness.dart'; + +class Example extends BenchmarkBase { + const Example() : super("Example"); + + // The benchmark code. + void run() {} + + // Not measured setup code executed prior to the benchmark runs. + void setup() {} + + // Not measures teardown code executed after the benchark runs. + void teardown() {} +} + +main() { + const Example().report(); +} diff --git a/tools/bots/try_benchmarks.sh b/tools/bots/try_benchmarks.sh index 5ec145e4c9f..c463b12b7cc 100755 --- a/tools/bots/try_benchmarks.sh +++ b/tools/bots/try_benchmarks.sh @@ -105,6 +105,7 @@ for command; do pkg \ runtime/bin \ runtime/lib \ + benchmarks \ || (rm -f linux-ia32_profile.tar.gz; exit 1) strip -w \ -K 'kDartVmSnapshotData' \ @@ -188,6 +189,7 @@ for command; do pkg \ runtime/bin \ runtime/lib \ + benchmarks \ || (rm -f linux-ia32.tar.gz; exit 1) elif [ "$command" = linux-ia32-benchmark ]; then rm -rf tmp @@ -219,6 +221,7 @@ EOF out/ReleaseIA32/run_vm_tests InitialRSS out/ReleaseIA32/run_vm_tests GenKernelKernelLoadKernel out/ReleaseIA32/run_vm_tests KernelServiceCompileAll + out/ReleaseIA32/dart --profile-period=10000 --packages=.packages benchmarks/Example/dart/Example.dart cd .. rm -rf tmp elif [ "$command" = linux-x64-build ] || @@ -264,6 +267,7 @@ EOF pkg \ runtime/bin \ runtime/lib \ + benchmarks \ || (rm -f linux-x64_profile.tar.gz; exit 1) strip -w \ -K 'kDartVmSnapshotData' \ @@ -366,6 +370,7 @@ EOF pkg \ runtime/bin \ runtime/lib \ + benchmarks \ || (rm -f linux-x64.tar.gz; exit 1) elif [ "$command" = linux-x64-benchmark ] || [ "$command" = linux-x64-bytecode-benchmark ]; then @@ -403,6 +408,7 @@ EOF out/ReleaseX64/run_vm_tests InitialRSS out/ReleaseX64/run_vm_tests GenKernelKernelLoadKernel out/ReleaseX64/run_vm_tests KernelServiceCompileAll + out/ReleaseX64/dart --profile-period=10000 --packages=.packages benchmarks/Example/dart/Example.dart cd .. rm -rf tmp else