bm_callback_unary_ping_pong.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2019 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
22 
23 namespace grpc {
24 namespace testing {
25 
26 /*******************************************************************************
27  * CONFIGURATIONS
28  */
29 
30 // Replace "benchmark::internal::Benchmark" with "::testing::Benchmark" to use
31 // internal microbenchmarking tooling
33  b->Args({0, 0});
34  for (int i = 1; i <= 128 * 1024 * 1024; i *= 8) {
35  // First argument is the message size of request
36  // Second argument is the message size of response
37  b->Args({i, 0});
38  b->Args({0, i});
39  b->Args({i, i});
40  }
41 }
42 
43 // Unary ping pong with different message size of request and response
44 BENCHMARK_TEMPLATE(BM_CallbackUnaryPingPong, InProcess, NoOpMutator,
45  NoOpMutator)
46  ->Apply(SweepSizesArgs);
48  NoOpMutator)
49  ->Apply(SweepSizesArgs);
50 
51 // Client context with different metadata
54  ->Args({0, 0});
57  ->Args({0, 0});
61  ->Args({0, 0});
64  ->Args({0, 0});
67  ->Args({0, 0});
71  ->Args({0, 0});
74  ->Args({0, 0});
77  ->Args({0, 0});
80  ->Args({0, 0});
81 
82 // Server context with different metadata
85  ->Args({0, 0});
88  ->Args({0, 0});
91  ->Args({0, 0});
94  ->Args({0, 0});
97  ->Args({0, 0});
100  ->Args({0, 0});
103  ->Args({0, 0});
104 } // namespace testing
105 } // namespace grpc
106 
107 // Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
108 // and others do not. This allows us to support both modes.
109 namespace benchmark {
111 } // namespace benchmark
112 
113 int main(int argc, char** argv) {
114  grpc::testing::TestEnvironment env(&argc, argv);
115  LibraryInitializer libInit;
116  ::benchmark::Initialize(&argc, argv);
117  grpc::testing::InitTest(&argc, &argv, false);
119  return 0;
120 }
grpc::testing::InitTest
void InitTest(int *argc, char ***argv, bool remove_flags)
Definition: test_config_cc.cc:28
testing
Definition: aws_request_signer_test.cc:25
benchmark
Definition: bm_alarm.cc:55
generate.env
env
Definition: generate.py:37
grpc
Definition: grpcpp/alarm.h:33
grpc::testing::RandomAsciiMetadata
Definition: fullstack_context_mutators.h:80
grpc::testing::MinInProcess
MinStackize< InProcess > MinInProcess
Definition: fullstack_fixtures.h:330
callback_unary_ping_pong.h
benchmark::RunTheBenchmarksNamespaced
void RunTheBenchmarksNamespaced()
Definition: bm_alarm.cc:56
grpc::testing::SweepSizesArgs
static void SweepSizesArgs(benchmark::internal::Benchmark *b)
Definition: bm_callback_unary_ping_pong.cc:32
grpc::testing::BM_CallbackUnaryPingPong
static void BM_CallbackUnaryPingPong(benchmark::State &state)
Definition: callback_unary_ping_pong.h:65
grpc::testing::BENCHMARK_TEMPLATE
BENCHMARK_TEMPLATE(BM_CallbackBidiStreaming, InProcess, NoOpMutator, NoOpMutator) -> Apply(StreamingPingPongMsgSizeArgs)
benchmark::RunSpecifiedBenchmarks
size_t RunSpecifiedBenchmarks()
Definition: benchmark/src/benchmark.cc:437
main
int main(int argc, char **argv)
Definition: bm_callback_unary_ping_pong.cc:113
benchmark::Initialize
void Initialize(int *argc, char **argv)
Definition: benchmark/src/benchmark.cc:602
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
benchmark::internal::Benchmark
Definition: benchmark/include/benchmark/benchmark.h:834
LibraryInitializer
Definition: helpers.h:33
test_config.h
grpc::testing::InProcess
Definition: fullstack_fixtures.h:154
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
grpc::testing::RandomBinaryMetadata
Definition: fullstack_context_mutators.h:59
test_config.h
grpc::testing::Client_AddMetadata
Definition: fullstack_context_mutators.h:101
grpc::testing::NoOpMutator
Definition: fullstack_context_mutators.h:52
grpc::testing::Server_AddInitialMetadata
Definition: fullstack_context_mutators.h:111
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:48