diff options
Diffstat (limited to 'test/cpp/microbenchmarks')
-rw-r--r-- | test/cpp/microbenchmarks/BUILD | 93 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_call_create.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_closure.cc | 3 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_cq.cc | 3 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_error.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc | 3 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc | 3 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_fullstack_trickle.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc | 3 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_metadata.cc | 17 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/helpers.h | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/noop-benchmark.cc | 2 |
12 files changed, 105 insertions, 30 deletions
diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD new file mode 100644 index 0000000000..38619666dc --- /dev/null +++ b/test/cpp/microbenchmarks/BUILD @@ -0,0 +1,93 @@ +# Copyright 2017, 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. + +licenses(["notice"]) # 3-clause BSD + +cc_test( + name = "noop-benchmark", + srcs = ["noop-benchmark.cc"], + deps = ["//external:benchmark"], + linkopts = ["-pthread"], +) + +cc_library( + name = "helpers", + srcs = ["helpers.cc"], + hdrs = ["helpers.h", "fullstack_fixtures.h", "fullstack_context_mutators.h"], + deps = ["//:grpc++", "//external:benchmark", "//test/core/util:grpc_test_util", "//src/proto/grpc/testing:echo_proto"], + linkopts = ["-pthread"], +) + +cc_test( + name = "bm_closure", + srcs = ["bm_closure.cc"], + deps = [":helpers"], +) + +cc_test( + name = "bm_cq", + srcs = ["bm_cq.cc"], + deps = [":helpers"], +) + +cc_test( + name = "bm_error", + srcs = ["bm_error.cc"], + deps = [":helpers"], +) + +cc_test( + name = "bm_fullstack_streaming_ping_pong", + srcs = ["bm_fullstack_streaming_ping_pong.cc"], + deps = [":helpers"], + + ) +cc_test( + name = "bm_fullstack_streaming_pump", + srcs = ["bm_fullstack_streaming_pump.cc"], + deps = [":helpers"], +) + +cc_test( + name = "bm_fullstack_trickle", + srcs = ["bm_fullstack_trickle.cc"], + deps = [":helpers"], +) + +cc_test( + name = "bm_fullstack_unary_ping_pong", + srcs = ["bm_fullstack_unary_ping_pong.cc"], + deps = [":helpers"], +) + +cc_test( + name = "bm_metadata", + srcs = ["bm_metadata.cc"], + deps = [":helpers"], +) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 1ef8caa690..4af2263e82 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -34,6 +34,7 @@ /* This benchmark exists to ensure that the benchmark integration is * working */ +#include <benchmark/benchmark.h> #include <string.h> #include <sstream> @@ -60,7 +61,6 @@ extern "C" { #include "src/cpp/client/create_channel_internal.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/microbenchmarks/helpers.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" auto &force_library_initialization = Library::get(); diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index 28a385b6c1..d52fe4ee30 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -33,7 +33,9 @@ /* Test various closure related operations */ +#include <benchmark/benchmark.h> #include <grpc/grpc.h> +#include <sstream> extern "C" { #include "src/core/lib/iomgr/closure.h" @@ -43,7 +45,6 @@ extern "C" { } #include "test/cpp/microbenchmarks/helpers.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" auto& force_library_initialization = Library::get(); diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 91e6a85101..676695b63c 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -34,12 +34,11 @@ /* This benchmark exists to ensure that the benchmark integration is * working */ +#include <benchmark/benchmark.h> #include <grpc++/completion_queue.h> #include <grpc++/impl/grpc_library.h> #include <grpc/grpc.h> - #include "test/cpp/microbenchmarks/helpers.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" extern "C" { #include "src/core/lib/surface/completion_queue.h" diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc index 00e1a08cab..ea9777bbe6 100644 --- a/test/cpp/microbenchmarks/bm_error.cc +++ b/test/cpp/microbenchmarks/bm_error.cc @@ -33,6 +33,7 @@ /* Test various operations on grpc_error */ +#include <benchmark/benchmark.h> #include <memory> extern "C" { @@ -41,7 +42,6 @@ extern "C" { } #include "test/cpp/microbenchmarks/helpers.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" auto& force_library_initialization = Library::get(); diff --git a/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc b/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc index 42a5381e27..c536e15a2c 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc @@ -33,14 +33,13 @@ /* Benchmark gRPC end2end in various configurations */ +#include <benchmark/benchmark.h> #include <sstream> - #include "src/core/lib/profiling/timers.h" #include "src/cpp/client/create_channel_internal.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/microbenchmarks/fullstack_context_mutators.h" #include "test/cpp/microbenchmarks/fullstack_fixtures.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" namespace grpc { namespace testing { diff --git a/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc b/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc index dc0e7d769a..5c1eb1165b 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc @@ -33,14 +33,13 @@ /* Benchmark gRPC end2end in various configurations */ +#include <benchmark/benchmark.h> #include <sstream> - #include "src/core/lib/profiling/timers.h" #include "src/cpp/client/create_channel_internal.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/microbenchmarks/fullstack_context_mutators.h" #include "test/cpp/microbenchmarks/fullstack_fixtures.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" namespace grpc { namespace testing { diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc index 5011f06368..c563f28b55 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc @@ -33,12 +33,12 @@ /* Benchmark gRPC end2end in various configurations */ +#include <benchmark/benchmark.h> #include "src/core/lib/profiling/timers.h" #include "src/cpp/client/create_channel_internal.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/microbenchmarks/fullstack_context_mutators.h" #include "test/cpp/microbenchmarks/fullstack_fixtures.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" extern "C" { #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/ext/transport/chttp2/transport/internal.h" diff --git a/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc b/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc index e51d272b10..615b05b7c7 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc @@ -33,14 +33,13 @@ /* Benchmark gRPC end2end in various configurations */ +#include <benchmark/benchmark.h> #include <sstream> - #include "src/core/lib/profiling/timers.h" #include "src/cpp/client/create_channel_internal.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/microbenchmarks/fullstack_context_mutators.h" #include "test/cpp/microbenchmarks/fullstack_fixtures.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" namespace grpc { namespace testing { diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc index 34874b57f5..7029f369ad 100644 --- a/test/cpp/microbenchmarks/bm_metadata.cc +++ b/test/cpp/microbenchmarks/bm_metadata.cc @@ -33,17 +33,15 @@ /* Test out various metadata handling primitives */ +#include <benchmark/benchmark.h> #include <grpc/grpc.h> extern "C" { -#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/static_metadata.h" -#include "src/core/lib/transport/transport.h" } #include "test/cpp/microbenchmarks/helpers.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" auto& force_library_initialization = Library::get(); @@ -65,19 +63,6 @@ static void BM_SliceFromCopied(benchmark::State& state) { } BENCHMARK(BM_SliceFromCopied); -static void BM_SliceFromStreamOwnedBuffer(benchmark::State& state) { - grpc_stream_refcount r; - GRPC_STREAM_REF_INIT(&r, 1, NULL, NULL, "test"); - char buffer[64]; - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - while (state.KeepRunning()) { - grpc_slice_unref_internal(&exec_ctx, grpc_slice_from_stream_owned_buffer( - &r, buffer, sizeof(buffer))); - } - grpc_exec_ctx_finish(&exec_ctx); -} -BENCHMARK(BM_SliceFromStreamOwnedBuffer); - static void BM_SliceIntern(benchmark::State& state) { TrackCounters track_counters; gpr_slice slice = grpc_slice_from_static_string("abc"); diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h index f44b7cf83a..49ed517b1d 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -41,8 +41,8 @@ extern "C" { #include "test/core/util/memory_counters.h" } +#include <benchmark/benchmark.h> #include <grpc++/impl/grpc_library.h> -#include "third_party/benchmark/include/benchmark/benchmark.h" class Library { public: diff --git a/test/cpp/microbenchmarks/noop-benchmark.cc b/test/cpp/microbenchmarks/noop-benchmark.cc index 99fa6d5f6e..7372ad04f2 100644 --- a/test/cpp/microbenchmarks/noop-benchmark.cc +++ b/test/cpp/microbenchmarks/noop-benchmark.cc @@ -34,7 +34,7 @@ /* This benchmark exists to ensure that the benchmark integration is * working */ -#include "third_party/benchmark/include/benchmark/benchmark.h" +#include <benchmark/benchmark.h> static void BM_NoOp(benchmark::State& state) { while (state.KeepRunning()) { |