Commit b804266f authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Add google_benchmark depdendency

This adds Google benchmark for microbenchmarking C++ code as an
optional dependency.

To enable, add the following to the .gclient before syncing
  "custom_vars": {
      "checkout_google_benchmark": True
  }

Change-Id: Id0eab772dd71558906658ef4bb60e31acd665948
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2275964Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68663}
parent 458702f9
......@@ -4,6 +4,7 @@
gclient_gn_args_file = 'v8/build/config/gclient_args.gni'
gclient_gn_args = [
'checkout_google_benchmark',
'mac_xcode_version',
]
......@@ -33,6 +34,8 @@ vars = {
'download_jsfunfuzz': False,
'check_v8_header_includes': False,
'checkout_google_benchmark' : False,
'mac_xcode_version': 'default',
# GN CIPD package version.
......@@ -186,6 +189,10 @@ deps = {
},
'v8/third_party/googletest/src':
Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '4fe018038f87675c083d0cfb6a6b57c274fb1753',
'v8/third_party/google_benchmark/src': {
'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + '7f27afe83b82f3a98baf58ef595814b9d42a5b2b',
'condition': 'checkout_google_benchmark',
},
'v8/third_party/jinja2':
Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '3f90fa05c85718505e28c9c3426c1ba52843b9b7',
'v8/third_party/markupsafe':
......
......@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/gclient_args.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/v8_target_cpu.gni")
import("split_static_library.gni")
......@@ -65,6 +66,8 @@ declare_args() {
# Add fuzzilli fuzzer support.
v8_fuzzilli = false
v8_enable_google_benchmark = checkout_google_benchmark
}
if (v8_use_external_startup_data == "") {
......
......@@ -33,6 +33,7 @@ group("gn_all") {
if (host_os != "mac" || !is_android) {
# These items don't compile for Android on Mac.
deps += [
"benchmarks/cpp:gn_all",
"cctest:cctest",
"cctest:generate-bytecode-expectations",
"unittests:unittests",
......
# Copyright 2020 The V8 project 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("../../../gni/v8.gni")
group("gn_all") {
testonly = true
deps = []
if (v8_enable_google_benchmark) {
deps += [ ":empty_benchmark" ]
}
}
if (v8_enable_google_benchmark) {
v8_executable("empty_benchmark") {
testonly = true
configs = []
sources = [ "empty.cc" ]
deps = [ "//third_party/google_benchmark:benchmark_main" ]
}
}
include_rules = [
"+third_party/google_benchmark/src/include/benchmark/benchmark.h",
]
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/google_benchmark/src/include/benchmark/benchmark.h"
static void BM_Empty(benchmark::State& state) {
for (auto _ : state) {
}
}
// Register the function as a benchmark
BENCHMARK(BM_Empty);
# Copyright 2020 The V8 project 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("//build/config/gclient_args.gni")
if (checkout_google_benchmark) {
config("benchmark_config") {
include_dirs = [ "src/include" ]
}
source_set("google_benchmark") {
testonly = true
public = [ "src/include/benchmark/benchmark.h" ]
sources = [
"src/src/arraysize.h",
"src/src/benchmark.cc",
"src/src/benchmark_api_internal.cc",
"src/src/benchmark_api_internal.h",
"src/src/benchmark_name.cc",
"src/src/benchmark_register.cc",
"src/src/benchmark_register.h",
"src/src/benchmark_runner.cc",
"src/src/benchmark_runner.h",
"src/src/check.h",
"src/src/colorprint.cc",
"src/src/colorprint.h",
"src/src/commandlineflags.cc",
"src/src/commandlineflags.h",
"src/src/complexity.cc",
"src/src/complexity.h",
"src/src/console_reporter.cc",
"src/src/counter.cc",
"src/src/counter.h",
"src/src/csv_reporter.cc",
"src/src/cycle_clock.h",
"src/src/internal_macros.h",
"src/src/json_reporter.cc",
"src/src/log.h",
"src/src/mutex.h",
"src/src/re.h",
"src/src/reporter.cc",
"src/src/sleep.cc",
"src/src/sleep.h",
"src/src/statistics.cc",
"src/src/statistics.h",
"src/src/string_util.cc",
"src/src/string_util.h",
"src/src/sysinfo.cc",
"src/src/thread_manager.h",
"src/src/thread_timer.h",
"src/src/timers.cc",
"src/src/timers.h",
]
all_dependent_configs = [ ":benchmark_config" ]
defines = [
# Tell google_benchmark to always use standard regular expressions.
"HAVE_GNU_POSIX_REGEX=0",
"HAVE_POSIX_REGEX=0",
"HAVE_STD_REGEX=1",
]
}
source_set("benchmark_main") {
testonly = true
sources = [ "src/src/benchmark_main.cc" ]
deps = [ ":google_benchmark" ]
}
}
file:../../INFRA_OWNERS
mlippautz@chromium.org
Name: Google Benchmark
Short Name: benchmark
URL: https://github.com/google/benchmark
Version: unknown
License: Apache 2.0
License File: NOT_SHIPPED
Security Critical: no
Description:
A microbenchmark support library.
To include this library in the V8 checkout, add the following clause to
your .gclient configuration.
"custom_vars": {
"checkout_google_benchmark": True,
}
Local Additions:
* gn file for building in V8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment