aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-10-25 17:02:20 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-10-25 17:02:20 -0700
commitd3cd017f5d5e0d1b3ca94ce8e89389eff8d6f853 (patch)
tree79272177fa5e40b8d6c8fd49979a513bd06acb51
parent64100caec9c79b87a0b1ac2ac41f196a057b827a (diff)
Initial google_benchmark integration: source changes
-rw-r--r--.gitmodules3
-rw-r--r--build.yaml10
-rwxr-xr-xsrc/google_benchmark/gen_build_yaml.py51
-rw-r--r--test/cpp/microbenchmarks/noop-benchmark.cc45
m---------third_party/google_benchmark0
-rw-r--r--tools/buildgen/generate_build_additions.sh1
-rwxr-xr-xtools/run_tests/sanity/check_submodules.sh2
7 files changed, 111 insertions, 1 deletions
diff --git a/.gitmodules b/.gitmodules
index 3665cde63f..c32881cb95 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -17,3 +17,6 @@
[submodule "third_party/thrift"]
path = third_party/thrift
url = https://github.com/apache/thrift.git
+[submodule "third_party/google_benchmark"]
+ path = third_party/google_benchmark
+ url = https://github.com/google/benchmark
diff --git a/build.yaml b/build.yaml
index 4f4cf96f6f..f2021dbf93 100644
--- a/build.yaml
+++ b/build.yaml
@@ -3107,6 +3107,14 @@ targets:
- grpc
- gpr_test_util
- gpr
+- name: noop-benchmark
+ build: test
+ run: false
+ language: c++
+ src:
+ - test/cpp/microbenchmarks/noop-benchmark.cc
+ deps:
+ - google_benchmark
- name: proto_server_reflection_test
gtest: true
build: test
@@ -3579,6 +3587,8 @@ defaults:
global:
CPPFLAGS: -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter
LDFLAGS: -g
+ google_benchmark:
+ CPPFLAGS: -Ithird_party/google_benchmark/include -DHAVE_STD_REGEX
zlib:
CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration
$(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden
diff --git a/src/google_benchmark/gen_build_yaml.py b/src/google_benchmark/gen_build_yaml.py
new file mode 100755
index 0000000000..f3b3f46132
--- /dev/null
+++ b/src/google_benchmark/gen_build_yaml.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python2.7
+
+# Copyright 2015, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+import sys
+import glob
+import yaml
+
+os.chdir(os.path.dirname(sys.argv[0])+'/../..')
+
+out = {}
+
+out['libs'] = [{
+ 'name': 'google_benchmark',
+ 'build': 'private',
+ 'language': 'c++',
+ 'secure': 'no',
+ 'defaults': 'google_benchmark',
+ 'src': glob.glob('third_party/google_benchmark/src/*.cc'),
+ 'headers': glob.glob('third_party/google_benchmark/src/*.h') + glob.glob('third_party/google_benchmark/include/benchmark/*.h'),
+}]
+
+print yaml.dump(out)
diff --git a/test/cpp/microbenchmarks/noop-benchmark.cc b/test/cpp/microbenchmarks/noop-benchmark.cc
new file mode 100644
index 0000000000..6b06c69c6e
--- /dev/null
+++ b/test/cpp/microbenchmarks/noop-benchmark.cc
@@ -0,0 +1,45 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/* This benchmark exists to ensure that the google_benchmark integration is
+ * working */
+
+#include "third_party/google_benchmark/include/benchmark/benchmark.h"
+
+static void BM_NoOp(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ }
+}
+BENCHMARK(BM_NoOp);
+
+BENCHMARK_MAIN();
diff --git a/third_party/google_benchmark b/third_party/google_benchmark
new file mode 160000
+Subproject 44c25c892a6229b20db7cd9dc05584ea865896d
diff --git a/tools/buildgen/generate_build_additions.sh b/tools/buildgen/generate_build_additions.sh
index 9a1a7a7249..1ea47042f4 100644
--- a/tools/buildgen/generate_build_additions.sh
+++ b/tools/buildgen/generate_build_additions.sh
@@ -30,6 +30,7 @@
gen_build_yaml_dirs=" \
src/boringssl \
+ src/google_benchmark \
src/proto \
src/zlib \
test/core/bad_client \
diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh
index 6410646cd1..6ec0786c96 100755
--- a/tools/run_tests/sanity/check_submodules.sh
+++ b/tools/run_tests/sanity/check_submodules.sh
@@ -43,6 +43,7 @@ git submodule | awk '{ print $1 }' | sort > $submodules
cat << EOF | awk '{ print $1 }' | sort > $want_submodules
c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9 third_party/boringssl (version_for_cocoapods_2.0-100-gc880e42)
05b155ff59114735ec8cd089f669c4c3d8f59029 third_party/gflags (v2.1.0-45-g05b155f)
+ 44c25c892a6229b20db7cd9dc05584ea865896de third_party/google_benchmark (v0.1.0-343-g44c25c8)
c99458533a9b4c743ed51537e25989ea55944908 third_party/googletest (release-1.7.0)
a428e42072765993ff674fda72863c9f1aa2d268 third_party/protobuf (v3.1.0)
50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8)
@@ -52,4 +53,3 @@ EOF
diff -u $submodules $want_submodules
rm $submodules $want_submodules
-