• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 gRPC authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_package")
16load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "HISTORY", "grpc_cc_benchmark")
17
18licenses(["notice"])
19
20grpc_package(name = "test/cpp/microbenchmarks")
21
22grpc_cc_benchmark(
23    name = "noop-benchmark",
24    srcs = ["noop-benchmark.cc"],
25    deps = ["//test/core/test_util:grpc_test_util"],
26)
27
28grpc_cc_benchmark(
29    name = "bm_channel_args",
30    srcs = ["bm_channel_args.cc"],
31    external_deps = [
32        "absl/container:btree",
33    ],
34    monitoring = HISTORY,
35    deps = [
36        "//:grpc++",
37        "//src/core:channel_args",
38        "//test/core/test_util:grpc_test_util",
39    ],
40)
41
42grpc_cc_benchmark(
43    name = "bm_rng",
44    srcs = ["bm_rng.cc"],
45    external_deps = [
46        "absl/container:btree",
47    ],
48    monitoring = HISTORY,
49    deps = [
50        "//:grpc++",
51        "//src/core:channel_args",
52        "//test/core/test_util:grpc_test_util",
53    ],
54)
55
56grpc_cc_benchmark(
57    name = "bm_exec_ctx",
58    srcs = ["bm_exec_ctx.cc"],
59    uses_event_engine = False,
60    deps = [":helpers"],
61)
62
63grpc_cc_benchmark(
64    name = "bm_event_engine_run",
65    srcs = ["bm_event_engine_run.cc"],
66    external_deps = [
67        "absl/log:check",
68        "absl/debugging:leak_check",
69    ],
70    deps = [
71        ":helpers",
72        "//src/core:common_event_engine_closures",
73    ],
74)
75
76grpc_cc_benchmark(
77    name = "bm_thread_pool",
78    srcs = ["bm_thread_pool.cc"],
79    external_deps = [
80        "absl/log:check",
81    ],
82    monitoring = HISTORY,
83    uses_event_engine = False,
84    deps = [
85        ":helpers",
86        "//src/core:common_event_engine_closures",
87    ],
88)
89
90grpc_cc_library(
91    name = "helpers",
92    testonly = 1,
93    srcs = ["helpers.cc"],
94    hdrs = [
95        "fullstack_context_mutators.h",
96        "fullstack_fixtures.h",
97        "helpers.h",
98    ],
99    external_deps = [
100        "absl/log:check",
101        "benchmark",
102    ],
103    deps = [
104        "//:grpc++",
105        "//src/proto/grpc/testing:echo_cc_grpc",
106        "//test/core/test_util:grpc_test_util",
107        "//test/core/test_util:grpc_test_util_base",
108        "//test/cpp/util:test_config",
109    ],
110)
111
112# Need a secure version of helpers to benchmark opencensus
113grpc_cc_library(
114    name = "helpers_secure",
115    testonly = 1,
116    srcs = ["helpers.cc"],
117    hdrs = [
118        "fullstack_context_mutators.h",
119        "fullstack_fixtures.h",
120        "helpers.h",
121    ],
122    external_deps = [
123        "absl/log:check",
124        "benchmark",
125    ],
126    deps = [
127        "//:grpc++",
128        "//src/proto/grpc/testing:echo_cc_grpc",
129        "//test/core/test_util:grpc_test_util",
130        "//test/core/test_util:grpc_test_util_base",
131        "//test/cpp/util:test_config",
132    ],
133)
134
135grpc_cc_benchmark(
136    name = "bm_closure",
137    srcs = ["bm_closure.cc"],
138    monitoring = HISTORY,
139    deps = [
140        ":helpers",
141        "//src/core:closure",
142    ],
143)
144
145grpc_cc_benchmark(
146    name = "bm_huffman_decode",
147    srcs = ["bm_huffman_decode.cc"],
148    tags = [
149        "nomsan",
150        "notsan",
151        "noubsan",
152    ],
153    deps = [
154        ":helpers",
155        "//test/cpp/microbenchmarks/huffman_geometries",
156    ],
157)
158
159grpc_cc_benchmark(
160    name = "bm_alarm",
161    srcs = ["bm_alarm.cc"],
162    monitoring = HISTORY,
163    deps = [":helpers"],
164)
165
166grpc_cc_benchmark(
167    name = "bm_arena",
168    srcs = ["bm_arena.cc"],
169    tags = [
170        "notsan",
171    ],
172    uses_event_engine = False,
173    deps = [":helpers"],
174)
175
176grpc_cc_benchmark(
177    name = "bm_byte_buffer",
178    srcs = ["bm_byte_buffer.cc"],
179    external_deps = [
180        "absl/log:check",
181    ],
182    tags = [
183        "no_mac",
184        "no_windows",
185    ],
186    uses_event_engine = False,
187    deps = [":helpers"],
188)
189
190grpc_cc_benchmark(
191    name = "bm_channel",
192    srcs = ["bm_channel.cc"],
193    monitoring = HISTORY,
194    tags = [
195        "no_mac",
196        "no_windows",
197    ],
198    uses_event_engine = False,
199    deps = [":helpers"],
200)
201
202grpc_cc_benchmark(
203    name = "bm_cq",
204    srcs = ["bm_cq.cc"],
205    external_deps = [
206        "absl/log:check",
207    ],
208    monitoring = HISTORY,
209    deps = [":helpers"],
210)
211
212grpc_cc_benchmark(
213    name = "bm_cq_multiple_threads",
214    srcs = ["bm_cq_multiple_threads.cc"],
215    external_deps = [
216        "absl/log:check",
217    ],
218    uses_event_engine = False,
219    deps = [":helpers"],
220)
221
222grpc_cc_library(
223    name = "fullstack_streaming_ping_pong_h",
224    testonly = 1,
225    hdrs = [
226        "fullstack_streaming_ping_pong.h",
227    ],
228    external_deps = [
229        "absl/log:check",
230    ],
231    tags = [
232        "no_mac",
233        "no_windows",
234    ],
235    deps = [":helpers"],
236)
237
238grpc_cc_benchmark(
239    name = "bm_fullstack_streaming_ping_pong",
240    size = "large",
241    srcs = [
242        "bm_fullstack_streaming_ping_pong.cc",
243    ],
244    flaky = True,
245    deps = [":fullstack_streaming_ping_pong_h"],
246)
247
248grpc_cc_library(
249    name = "fullstack_streaming_pump_h",
250    testonly = 1,
251    hdrs = [
252        "fullstack_streaming_pump.h",
253    ],
254    external_deps = [
255        "absl/log:check",
256    ],
257    deps = [":helpers"],
258)
259
260grpc_cc_benchmark(
261    name = "bm_fullstack_streaming_pump",
262    srcs = [
263        "bm_fullstack_streaming_pump.cc",
264    ],
265    deps = [":fullstack_streaming_pump_h"],
266)
267
268grpc_cc_library(
269    name = "fullstack_unary_ping_pong_h",
270    testonly = 1,
271    hdrs = [
272        "fullstack_unary_ping_pong.h",
273    ],
274    external_deps = [
275        "absl/log:check",
276    ],
277    deps = [":helpers_secure"],
278)
279
280grpc_cc_benchmark(
281    name = "bm_fullstack_unary_ping_pong",
282    size = "large",
283    srcs = [
284        "bm_fullstack_unary_ping_pong.cc",
285    ],
286    deps = [":fullstack_unary_ping_pong_h"],
287)
288
289grpc_cc_benchmark(
290    name = "bm_fullstack_unary_ping_pong_chaotic_good",
291    srcs = [
292        "bm_fullstack_unary_ping_pong_chaotic_good.cc",
293    ],
294    deps = [
295        ":fullstack_unary_ping_pong_h",
296        "//:grpcpp_chaotic_good",
297    ],
298)
299
300grpc_cc_benchmark(
301    name = "bm_chttp2_hpack",
302    srcs = ["bm_chttp2_hpack.cc"],
303    external_deps = [
304        "absl/log:check",
305    ],
306    uses_event_engine = False,
307    deps = [
308        ":helpers",
309        "//src/core:slice",
310    ],
311)
312
313grpc_cc_benchmark(
314    name = "bm_opencensus_plugin",
315    srcs = ["bm_opencensus_plugin.cc"],
316    deps = [
317        ":helpers_secure",
318        "//:grpc_opencensus_plugin",
319        "//src/proto/grpc/testing:echo_cc_grpc",
320    ],
321)
322
323grpc_cc_library(
324    name = "bm_callback_test_service_impl",
325    testonly = 1,
326    srcs = ["callback_test_service.cc"],
327    hdrs = ["callback_test_service.h"],
328    external_deps = [
329        "absl/log:check",
330        "benchmark",
331    ],
332    deps = [
333        ":helpers",
334        "//src/proto/grpc/testing:echo_cc_grpc",
335        "//test/cpp/util:test_util",
336    ],
337)
338
339grpc_cc_library(
340    name = "callback_unary_ping_pong_h",
341    testonly = 1,
342    hdrs = [
343        "callback_unary_ping_pong.h",
344    ],
345    external_deps = [
346        "absl/log:check",
347    ],
348    deps = [
349        ":bm_callback_test_service_impl",
350        ":helpers",
351    ],
352)
353
354grpc_cc_benchmark(
355    name = "bm_callback_unary_ping_pong",
356    size = "large",
357    srcs = [
358        "bm_callback_unary_ping_pong.cc",
359    ],
360    deps = [":callback_unary_ping_pong_h"],
361)
362
363grpc_cc_library(
364    name = "callback_streaming_ping_pong_h",
365    testonly = 1,
366    hdrs = [
367        "callback_streaming_ping_pong.h",
368    ],
369    external_deps = [
370        "absl/log:check",
371    ],
372    deps = [
373        ":bm_callback_test_service_impl",
374        ":helpers",
375    ],
376)
377
378grpc_cc_benchmark(
379    name = "bm_callback_streaming_ping_pong",
380    srcs = [
381        "bm_callback_streaming_ping_pong.cc",
382    ],
383    deps = [":callback_streaming_ping_pong_h"],
384)
385
386# TODO(hork): Generalize this for other work queue implementations
387grpc_cc_benchmark(
388    name = "bm_basic_work_queue",
389    srcs = ["bm_basic_work_queue.cc"],
390    external_deps = [
391        "absl/log:check",
392    ],
393    tags = [
394        "manual",
395        "notap",
396    ],
397    deps = [
398        "//:gpr",
399        "//src/core:common_event_engine_closures",
400        "//src/core:event_engine_basic_work_queue",
401        "//test/core/test_util:grpc_test_util",
402    ],
403)
404
405grpc_cc_benchmark(
406    name = "bm_stats_plugin",
407    srcs = ["bm_stats_plugin.cc"],
408    external_deps = [
409        "absl/strings",
410        "otel/sdk/src/metrics",
411    ],
412    monitoring = HISTORY,
413    deps = [
414        ":helpers",
415        "//src/core:metrics",
416        "//src/cpp/ext/otel:otel_plugin",
417        "//test/core/test_util:fake_stats_plugin",
418        "//test/core/test_util:grpc_test_util",
419    ],
420)
421