bm_callback_streaming_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  // base case: 0 byte ping-pong msgs
34  b->Args({0, 1});
35  b->Args({0, 2});
36 
37  for (int msg_size = 1; msg_size <= 128 * 1024 * 1024; msg_size *= 8) {
38  b->Args({msg_size, 1});
39  b->Args({msg_size, 2});
40  }
41 }
42 
43 // Replace "benchmark::internal::Benchmark" with "::testing::Benchmark" to use
44 // internal microbenchmarking tooling
46  for (int msg_number = 1; msg_number <= 256 * 1024; msg_number *= 8) {
47  b->Args({0, msg_number});
48  b->Args({1024, msg_number});
49  }
50 }
51 
52 // Streaming with different message size
53 BENCHMARK_TEMPLATE(BM_CallbackBidiStreaming, InProcess, NoOpMutator,
54  NoOpMutator)
57  NoOpMutator)
59 
60 // Streaming with different message number
61 BENCHMARK_TEMPLATE(BM_CallbackBidiStreaming, InProcess, NoOpMutator,
62  NoOpMutator)
65  NoOpMutator)
67 
68 // Client context with different metadata
71  ->Args({0, 1});
74  ->Args({0, 1});
78  ->Args({0, 1});
81  ->Args({0, 1});
84  ->Args({0, 1});
88  ->Args({0, 1});
91  ->Args({0, 1});
94  ->Args({0, 1});
97  ->Args({0, 1});
98 
99 // Server context with different metadata
102  ->Args({0, 1});
105  ->Args({0, 1});
108  ->Args({0, 1});
111  ->Args({0, 1});
114  ->Args({0, 1});
117  ->Args({0, 1});
120  ->Args({0, 1});
121 
122 } // namespace testing
123 } // namespace grpc
124 
125 // Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
126 // and others do not. This allows us to support both modes.
127 namespace benchmark {
129 } // namespace benchmark
130 
131 int main(int argc, char** argv) {
132  grpc::testing::TestEnvironment env(&argc, argv);
133  LibraryInitializer libInit;
134  ::benchmark::Initialize(&argc, argv);
135  grpc::testing::InitTest(&argc, &argv, false);
137  return 0;
138 }
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
benchmark::RunTheBenchmarksNamespaced
void RunTheBenchmarksNamespaced()
Definition: bm_alarm.cc:56
grpc::testing::BENCHMARK_TEMPLATE
BENCHMARK_TEMPLATE(BM_CallbackBidiStreaming, InProcess, NoOpMutator, NoOpMutator) -> Apply(StreamingPingPongMsgSizeArgs)
callback_streaming_ping_pong.h
benchmark::RunSpecifiedBenchmarks
size_t RunSpecifiedBenchmarks()
Definition: benchmark/src/benchmark.cc:437
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
main
int main(int argc, char **argv)
Definition: bm_callback_streaming_ping_pong.cc:131
grpc::testing::RandomBinaryMetadata
Definition: fullstack_context_mutators.h:59
test_config.h
grpc::testing::BM_CallbackBidiStreaming
static void BM_CallbackBidiStreaming(benchmark::State &state)
Definition: callback_streaming_ping_pong.h:123
grpc::testing::Client_AddMetadata
Definition: fullstack_context_mutators.h:101
grpc::testing::StreamingPingPongMsgsNumberArgs
static void StreamingPingPongMsgsNumberArgs(benchmark::internal::Benchmark *b)
Definition: bm_callback_streaming_ping_pong.cc:45
grpc::testing::StreamingPingPongMsgSizeArgs
static void StreamingPingPongMsgSizeArgs(benchmark::internal::Benchmark *b)
Definition: bm_callback_streaming_ping_pong.cc:32
grpc::testing::NoOpMutator
Definition: fullstack_context_mutators.h:52
grpc::testing::Server_AddInitialMetadata
Definition: fullstack_context_mutators.h:111


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