diff options
author | Craig Tiller <ctiller@google.com> | 2017-03-30 12:25:43 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-03-30 12:25:43 -0700 |
commit | 75b690874856a1621dc42b291f7d4df7f9b95479 (patch) | |
tree | 5fae817dabad3722012fc35c07d78562237fe066 /test/cpp/microbenchmarks | |
parent | ed5651b17393dfd0c01fdbb9551d4ee0339f1cce (diff) | |
parent | 1a3c82063e8a7c532ebfbb9509aa3a9617cda157 (diff) |
Merge github.com:grpc/grpc into new_transport_op
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_chttp2_hpack.cc | 163 | ||||
-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 |
13 files changed, 265 insertions, 33 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 adfff38c03..9af06d097b 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_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 563db758f7..8fbfd0fa13 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -33,6 +33,7 @@ /* Microbenchmarks around CHTTP2 HPACK operations */ +#include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <string.h> #include <sstream> @@ -40,6 +41,7 @@ extern "C" { #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/transport/static_metadata.h" } #include "test/cpp/microbenchmarks/helpers.h" @@ -69,6 +71,7 @@ template <class Fixture> static void BM_HpackEncoderEncodeHeader(benchmark::State &state) { TrackCounters track_counters; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + static bool logged_representative_output = false; grpc_metadata_batch b; grpc_metadata_batch_init(&b); @@ -87,8 +90,17 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State &state) { grpc_slice_buffer outbuf; grpc_slice_buffer_init(&outbuf); while (state.KeepRunning()) { - grpc_chttp2_encode_header(&exec_ctx, &c, (uint32_t)state.iterations(), &b, - state.range(0), state.range(1), &stats, &outbuf); + uint32_t stream_id = static_cast<uint32_t>(state.iterations()); + grpc_chttp2_encode_header(&exec_ctx, &c, stream_id, &b, state.range(0), + state.range(1), &stats, &outbuf); + if (!logged_representative_output) { + logged_representative_output = true; + for (size_t i = 0; i < outbuf.count; i++) { + char *s = grpc_dump_slice(outbuf.slices[i], GPR_DUMP_HEX); + gpr_log(GPR_DEBUG, "%" PRId64 ": %s", i, s); + gpr_free(s); + } + } grpc_slice_buffer_reset_and_unref_internal(&exec_ctx, &outbuf); grpc_exec_ctx_flush(&exec_ctx); } @@ -131,6 +143,28 @@ class SingleInternedElem { } }; +template <int kLength> +class SingleInternedBinaryElem { + public: + static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) { + grpc_slice bytes = MakeBytes(); + std::vector<grpc_mdelem> out = {grpc_mdelem_from_slices( + exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc-bin")), + grpc_slice_intern(bytes))}; + grpc_slice_unref(bytes); + return out; + } + + private: + static grpc_slice MakeBytes() { + std::vector<char> v; + for (int i = 0; i < kLength; i++) { + v.push_back(static_cast<char>(rand())); + } + return grpc_slice_from_copied_buffer(v.data(), v.size()); + } +}; + class SingleInternedKeyElem { public: static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) { @@ -149,6 +183,24 @@ class SingleNonInternedElem { } }; +template <int kLength> +class SingleNonInternedBinaryElem { + public: + static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) { + return {grpc_mdelem_from_slices( + exec_ctx, grpc_slice_from_static_string("abc-bin"), MakeBytes())}; + } + + private: + static grpc_slice MakeBytes() { + std::vector<char> v; + for (int i = 0; i < kLength; i++) { + v.push_back(static_cast<char>(rand())); + } + return grpc_slice_from_copied_buffer(v.data(), v.size()); + } +}; + class RepresentativeClientInitialMetadata { public: static std::vector<grpc_mdelem> GetElems(grpc_exec_ctx *exec_ctx) { @@ -195,8 +247,29 @@ BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedKeyElem) ->Args({0, 16384}); BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedElem) ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<1>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<3>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<10>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<31>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<100>) + ->Args({0, 16384}); BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedElem) ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedBinaryElem<1>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedBinaryElem<3>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedBinaryElem<10>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedBinaryElem<31>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<100>) + ->Args({0, 16384}); // test with a tiny frame size, to highlight continuation costs BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedElem) ->Args({0, 1}); @@ -255,6 +328,8 @@ static void BM_HpackParserParseHeader(benchmark::State &state) { } grpc_exec_ctx_flush(&exec_ctx); } + for (auto slice : init_slices) grpc_slice_unref(slice); + for (auto slice : benchmark_slices) grpc_slice_unref(slice); grpc_chttp2_hpack_parser_destroy(&exec_ctx, &p); grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); @@ -262,7 +337,7 @@ static void BM_HpackParserParseHeader(benchmark::State &state) { namespace hpack_parser_fixtures { -static grpc_slice MakeSlice(std::initializer_list<uint8_t> bytes) { +static grpc_slice MakeSlice(std::vector<uint8_t> bytes) { grpc_slice s = grpc_slice_malloc(bytes.size()); uint8_t *p = GRPC_SLICE_START_PTR(s); for (auto b : bytes) { @@ -346,6 +421,64 @@ class NonIndexedElem { } }; +class NonIndexedBinaryElem1 { + public: + static std::vector<grpc_slice> GetInitSlices() { return {}; } + static std::vector<grpc_slice> GetBenchmarkSlices() { + return {MakeSlice( + {0x00, 0x07, 'a', 'b', 'c', '-', 'b', 'i', 'n', 0x82, 0xf7, 0xb3})}; + } +}; + +class NonIndexedBinaryElem3 { + public: + static std::vector<grpc_slice> GetInitSlices() { return {}; } + static std::vector<grpc_slice> GetBenchmarkSlices() { + return {MakeSlice({0x00, 0x07, 'a', 'b', 'c', '-', 'b', 'i', 'n', 0x84, + 0x7f, 0x4e, 0x29, 0x3f})}; + } +}; + +class NonIndexedBinaryElem10 { + public: + static std::vector<grpc_slice> GetInitSlices() { return {}; } + static std::vector<grpc_slice> GetBenchmarkSlices() { + return {MakeSlice({0x00, 0x07, 'a', 'b', 'c', '-', 'b', + 'i', 'n', 0x8b, 0x71, 0x0c, 0xa5, 0x81, + 0x73, 0x7b, 0x47, 0x13, 0xe9, 0xf7, 0xe3})}; + } +}; + +class NonIndexedBinaryElem31 { + public: + static std::vector<grpc_slice> GetInitSlices() { return {}; } + static std::vector<grpc_slice> GetBenchmarkSlices() { + return {MakeSlice({0x00, 0x07, 'a', 'b', 'c', '-', 'b', 'i', 'n', + 0xa3, 0x92, 0x43, 0x7f, 0xbe, 0x7c, 0xea, 0x6f, 0xf3, + 0x3d, 0xa7, 0xa7, 0x67, 0xfb, 0xe2, 0x82, 0xf7, 0xf2, + 0x8f, 0x1f, 0x9d, 0xdf, 0xf1, 0x7e, 0xb3, 0xef, 0xb2, + 0x8f, 0x53, 0x77, 0xce, 0x0c, 0x13, 0xe3, 0xfd, 0x87})}; + } +}; + +class NonIndexedBinaryElem100 { + public: + static std::vector<grpc_slice> GetInitSlices() { return {}; } + static std::vector<grpc_slice> GetBenchmarkSlices() { + return {MakeSlice( + {0x00, 0x07, 'a', 'b', 'c', '-', 'b', 'i', 'n', 0xeb, 0x1d, 0x4d, + 0xe8, 0x96, 0x8c, 0x14, 0x20, 0x06, 0xc1, 0xc3, 0xdf, 0x6e, 0x1f, 0xef, + 0xde, 0x2f, 0xde, 0xb7, 0xf2, 0xfe, 0x6d, 0xd4, 0xe4, 0x7d, 0xf5, 0x55, + 0x46, 0x52, 0x3d, 0x91, 0xf2, 0xd4, 0x6f, 0xca, 0x34, 0xcd, 0xd9, 0x39, + 0xbd, 0x03, 0x27, 0xe3, 0x9c, 0x74, 0xcc, 0x17, 0x34, 0xed, 0xa6, 0x6a, + 0x77, 0x73, 0x10, 0xcd, 0x8e, 0x4e, 0x5c, 0x7c, 0x72, 0x39, 0xd8, 0xe6, + 0x78, 0x6b, 0xdb, 0xa5, 0xb7, 0xab, 0xe7, 0x46, 0xae, 0x21, 0xab, 0x7f, + 0x01, 0x89, 0x13, 0xd7, 0xca, 0x17, 0x6e, 0xcb, 0xd6, 0x79, 0x71, 0x68, + 0xbf, 0x8a, 0x3f, 0x32, 0xe8, 0xba, 0xf5, 0xbe, 0xb3, 0xbc, 0xde, 0x28, + 0xc7, 0xcf, 0x62, 0x7a, 0x58, 0x2c, 0xcf, 0x4d, 0xe3})}; + } +}; + class RepresentativeClientInitialMetadata { public: static std::vector<grpc_slice> GetInitSlices() { @@ -437,6 +570,11 @@ BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, IndexedSingleInternedElem); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, AddIndexedSingleInternedElem); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, KeyIndexedSingleInternedElem); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedElem); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem1); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem3); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem10); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem31); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem100); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, RepresentativeClientInitialMetadata); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, @@ -446,4 +584,23 @@ BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, } // namespace hpack_parser_fixtures +static void BM_Base16SomeStuff(benchmark::State &state) { + uint8_t *bytes = new uint8_t[state.range(0)]; + for (int i = 0; i < state.range(0); i++) { + bytes[i] = static_cast<uint8_t>(rand()); + } + uint8_t *encoded = new uint8_t[state.range(0) * 2]; + static const uint8_t hex[] = "0123456789abcdef"; + while (state.KeepRunning()) { + for (int i = 0; i < state.range(0); i++) { + encoded[2 * i + 0] = hex[encoded[i] >> 8]; + encoded[2 * i + 1] = hex[encoded[i] & 0xf]; + } + } + delete[] encoded; + delete[] bytes; + state.SetBytesProcessed(state.iterations() * state.range(0)); +} +BENCHMARK(BM_Base16SomeStuff)->Range(1, 4096); + BENCHMARK_MAIN(); 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()) { |