Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utility: add benchmark library, but don't use it yet. #2350

Merged
merged 7 commits into from
Jan 17, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def envoy_cc_binary(name,
data = [],
testonly = 0,
visibility = None,
external_deps = [],
repository = "",
stamped = False,
deps = [],
Expand All @@ -172,6 +173,7 @@ def envoy_cc_binary(name,
if stamped:
_git_stamped_genrule(repository, name)
_git_stamped_genrule(repository, name + ".stripped")
deps = deps + [envoy_external_dep_path(dep) for dep in external_deps]
native.cc_binary(
name = name,
srcs = srcs,
Expand Down
4 changes: 2 additions & 2 deletions bazel/external/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ cc_library(
name = "all_external",
srcs = [":empty.cc"],
deps = [
"@io_opentracing_cpp//:opentracing",
"@com_lightstep_tracer_cpp//:lightstep_tracer",
"@com_google_googletest//:gtest",
"@com_lightstep_tracer_cpp//:lightstep_tracer",
"@io_opentracing_cpp//:opentracing",
],
)

Expand Down
1 change: 1 addition & 0 deletions bazel/target_recipes.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# ci/build_container/build_recipes.
TARGET_RECIPES = {
"ares": "cares",
"benchmark": "benchmark",
"event": "libevent",
"event_pthreads": "libevent",
"tcmalloc_and_profiler": "gperftools",
Expand Down
22 changes: 22 additions & 0 deletions ci/build_container/build_recipes/benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove -x (once done debug) and add -e.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


export COMMIT="e1c3a83b8197cf02e794f61228461c27d4e78cfb" # benchmark @ Jan 11, 2018

git clone https://github.com/google/benchmark.git
(cd benchmark; git reset --hard "$COMMIT")
mkdir build

cd build
cmake -G "Unix Makefiles" ../benchmark \
-DCMAKE_BUILD_TYPE=RELEASE \
-DBENCHMARK_ENABLE_GTEST_TESTS=OFF
make
cp src/libbenchmark.a "$THIRDPARTY_BUILD"/lib
cd ../benchmark

pwd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

include_dir="$THIRDPARTY_BUILD/include/testing/base/public"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer INCLUDE_DIR for consistency with other variables (I know in Google we use lowercase, but we would need to switch everything over).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done; FWIW I thought lower-case variables were common in bash, and upper-case variables when they are exported.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are, and it's in the Google style guide, but we haven't had that convention in Envoy, so we tend to opt to be consistent with the existing code base as the lesser evil.

mkdir -p "$include_dir"
cp include/benchmark/benchmark.h "$include_dir"
7 changes: 7 additions & 0 deletions ci/prebuilt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ cc_library(
includes = ["thirdparty_build/include"],
)

cc_library(
name = "benchmark",
srcs = ["thirdparty_build/lib/libbenchmark.a"],
hdrs = ["thirdparty_build/include/testing/base/public/benchmark.h"],
includes = ["thirdparty_build/include"],
)

cc_library(
name = "crypto",
srcs = ["thirdparty_build/lib/libcrypto.a"],
Expand Down