Commit c63c9212 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

Add google benchmark to //third_party.

The library is used to build the benchmarks in google/crc32c. In the
future, it will be needed for building the benchmarks in
google/leveldb and google/snappy.

Bug: 1032895
Tested: gclient sync does not create third_party/benchmark/src/ by default. crc32c_benchmarks builds and runs when benchmarks are enabled.
Change-Id: I9b0200b4cbb815f309a66104916984343cb8f9d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943344Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMatthew Denton <mpdenton@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728134}
parent 57c76aad
......@@ -31,6 +31,7 @@ gclient_gn_args = [
'build_with_chromium',
'checkout_android',
'checkout_android_native_support',
'checkout_google_benchmark',
'checkout_ios_webkit',
'checkout_nacl',
'checkout_oculus_sdk',
......@@ -73,6 +74,11 @@ vars = {
# restricted to Googlers only.
'checkout_chromium_password_manager_test_dependencies': False,
# By default, do not check out Google Benchmark. The library is only used by a
# few specialized benchmarks that most developers do not interact with. Will
# be overridden by gclient variables.
'checkout_google_benchmark': False,
# Check out and download nacl by default. This can be disabled e.g. with
# custom_vars.
'checkout_nacl': True,
......@@ -800,6 +806,11 @@ deps = {
'dep_type': 'cipd',
},
'src/third_party/google_benchmark/src': {
'url': Var('chromium_git') + '/external/github.com/google/benchmark.git' + '@' + '367119482ff4abc3d73e4a109b410090fc281337',
'condition': 'checkout_google_benchmark',
},
'src/third_party/boringssl/src':
Var('boringssl_git') + '/boringssl.git' + '@' + Var('boringssl_revision'),
......
......@@ -93,6 +93,7 @@
/gnu_binutils/
/google_android_play_core/core-*.aar
/google_appengine_cloudstorage
/google_benchmark/src
/google_toolbox_for_mac/src
/googlemac
/grpc/src
......
......@@ -4,6 +4,7 @@
import("//build/config/features.gni")
import("//testing/test.gni")
import("//third_party/google_benchmark/buildconfig.gni")
# Only applied to CRC32C source and tests. (not exported)
config("crc32c_config") {
......@@ -166,3 +167,19 @@ test("crc32c_tests") {
"//third_party/googletest:gtest",
]
}
if (enable_google_benchmarks) {
test("crc32c_benchmark") {
sources = [
"src/src/crc32c_benchmark.cc",
]
configs += [ ":crc32c_config" ]
deps = [
":crc32c",
":crc32c_arm64",
":crc32c_internal_headers",
":crc32c_sse42",
"//third_party/google_benchmark",
]
}
}
# Copyright 2019 The Chromium 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("buildconfig.gni")
if (enable_google_benchmarks) {
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" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
defines = [
# Tell gtest 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",
]
}
}
# Primary for bugs, reviews:
pwnall@chromium.org
# Secondary:
jsbell@chromium.org
# TEAM: storage-dev@chromium.org
# COMPONENT: Internals>Storage
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.
Google Benchmark is NOT supported for writing benchmarks in Chromium. It is
included to run benchmarks in third-party code that have already been written
against Google Benchmarks.
To include this library in the Chromium checkout, add the following clause to
your .gclient configuration.
"custom_vars": {
"checkout_google_benchmark": True,
}
Local Additions:
* gn file for building in chromium
# Copyright 2019 The Chromium 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")
declare_args() {
# Google Benchmark is not checked out by default, because it is only used by
# a few specialized benchmarks that most developers do not interact with.
enable_google_benchmarks = checkout_google_benchmark
}
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