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 15licenses(["notice"]) 16 17load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package") 18 19grpc_package(name = "test/cpp/microbenchmarks") 20 21load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_benchmark_args") 22 23grpc_cc_test( 24 name = "noop-benchmark", 25 srcs = ["noop-benchmark.cc"], 26 external_deps = [ 27 "benchmark", 28 ], 29 deps = ["//test/core/util:grpc_test_util"], 30) 31 32grpc_cc_library( 33 name = "helpers", 34 testonly = 1, 35 srcs = ["helpers.cc"], 36 hdrs = [ 37 "fullstack_context_mutators.h", 38 "fullstack_fixtures.h", 39 "helpers.h", 40 ], 41 external_deps = [ 42 "benchmark", 43 ], 44 deps = [ 45 "//:grpc++_unsecure", 46 "//src/proto/grpc/testing:echo_proto", 47 "//test/core/util:grpc_test_util_unsecure", 48 "//test/cpp/util:test_config", 49 ], 50) 51 52# Need a secure version of helpers to benchmark opencensus 53grpc_cc_library( 54 name = "helpers_secure", 55 testonly = 1, 56 srcs = ["helpers.cc"], 57 hdrs = [ 58 "fullstack_context_mutators.h", 59 "fullstack_fixtures.h", 60 "helpers.h", 61 ], 62 external_deps = [ 63 "benchmark", 64 ], 65 deps = [ 66 "//:grpc++", 67 "//src/proto/grpc/testing:echo_proto", 68 "//test/core/util:grpc_test_util", 69 "//test/cpp/util:test_config", 70 ], 71) 72 73grpc_cc_test( 74 name = "bm_closure", 75 srcs = ["bm_closure.cc"], 76 args = grpc_benchmark_args(), 77 tags = [ 78 "no_mac", 79 "no_windows", 80 ], 81 deps = [":helpers"], 82) 83 84grpc_cc_test( 85 name = "bm_alarm", 86 srcs = ["bm_alarm.cc"], 87 args = grpc_benchmark_args(), 88 tags = [ 89 "no_mac", 90 "no_windows", 91 ], 92 deps = [":helpers"], 93) 94 95grpc_cc_test( 96 name = "bm_arena", 97 size = "large", 98 srcs = ["bm_arena.cc"], 99 args = grpc_benchmark_args(), 100 tags = [ 101 "no_mac", 102 "no_windows", 103 "notsan", 104 ], 105 uses_polling = False, 106 deps = [":helpers"], 107) 108 109grpc_cc_test( 110 name = "bm_byte_buffer", 111 srcs = ["bm_byte_buffer.cc"], 112 args = grpc_benchmark_args(), 113 tags = [ 114 "no_mac", 115 "no_windows", 116 ], 117 uses_polling = False, 118 deps = [":helpers"], 119) 120 121grpc_cc_test( 122 name = "bm_channel", 123 srcs = ["bm_channel.cc"], 124 args = grpc_benchmark_args(), 125 tags = [ 126 "no_mac", 127 "no_windows", 128 ], 129 uses_polling = False, 130 deps = [":helpers"], 131) 132 133grpc_cc_test( 134 name = "bm_call_create", 135 srcs = ["bm_call_create.cc"], 136 args = grpc_benchmark_args(), 137 tags = [ 138 "no_mac", 139 "no_windows", 140 ], 141 uses_polling = False, 142 deps = [":helpers"], 143) 144 145grpc_cc_test( 146 name = "bm_cq", 147 srcs = ["bm_cq.cc"], 148 args = grpc_benchmark_args(), 149 tags = [ 150 "no_mac", 151 "no_windows", 152 ], 153 deps = [":helpers"], 154) 155 156grpc_cc_test( 157 name = "bm_cq_multiple_threads", 158 srcs = ["bm_cq_multiple_threads.cc"], 159 args = grpc_benchmark_args(), 160 tags = [ 161 "no_mac", 162 "no_windows", 163 ], 164 uses_polling = False, 165 deps = [":helpers"], 166) 167 168grpc_cc_test( 169 name = "bm_error", 170 srcs = ["bm_error.cc"], 171 args = grpc_benchmark_args(), 172 tags = [ 173 "no_mac", 174 "no_windows", 175 ], 176 uses_polling = False, 177 deps = [":helpers"], 178) 179 180grpc_cc_library( 181 name = "fullstack_streaming_ping_pong_h", 182 testonly = 1, 183 hdrs = [ 184 "fullstack_streaming_ping_pong.h", 185 ], 186 tags = [ 187 "no_mac", 188 "no_windows", 189 ], 190 deps = [":helpers"], 191) 192 193grpc_cc_test( 194 name = "bm_fullstack_streaming_ping_pong", 195 size = "large", 196 srcs = [ 197 "bm_fullstack_streaming_ping_pong.cc", 198 ], 199 args = grpc_benchmark_args(), 200 tags = [ 201 "no_mac", # to emulate "excluded_poll_engines: poll" 202 "no_windows", 203 ], 204 deps = [":fullstack_streaming_ping_pong_h"], 205) 206 207grpc_cc_library( 208 name = "fullstack_streaming_pump_h", 209 testonly = 1, 210 hdrs = [ 211 "fullstack_streaming_pump.h", 212 ], 213 deps = [":helpers"], 214) 215 216grpc_cc_test( 217 name = "bm_fullstack_streaming_pump", 218 srcs = [ 219 "bm_fullstack_streaming_pump.cc", 220 ], 221 args = grpc_benchmark_args(), 222 tags = [ 223 "no_mac", # to emulate "excluded_poll_engines: poll" 224 "no_windows", 225 ], 226 deps = [":fullstack_streaming_pump_h"], 227) 228 229grpc_cc_test( 230 name = "bm_fullstack_trickle", 231 size = "large", 232 srcs = ["bm_fullstack_trickle.cc"], 233 args = grpc_benchmark_args(), 234 external_deps = [ 235 "absl/flags:flag", 236 ], 237 tags = [ 238 "manual", 239 "no_windows", 240 "notap", 241 ], 242 deps = [":helpers"], 243) 244 245grpc_cc_library( 246 name = "fullstack_unary_ping_pong_h", 247 testonly = 1, 248 hdrs = [ 249 "fullstack_unary_ping_pong.h", 250 ], 251 deps = [":helpers"], 252) 253 254grpc_cc_test( 255 name = "bm_fullstack_unary_ping_pong", 256 size = "large", 257 srcs = [ 258 "bm_fullstack_unary_ping_pong.cc", 259 ], 260 args = grpc_benchmark_args(), 261 tags = [ 262 "no_mac", # to emulate "excluded_poll_engines: poll" 263 "no_windows", 264 ], 265 deps = [":fullstack_unary_ping_pong_h"], 266) 267 268grpc_cc_test( 269 name = "bm_metadata", 270 srcs = ["bm_metadata.cc"], 271 args = grpc_benchmark_args(), 272 tags = [ 273 "no_mac", 274 "no_windows", 275 ], 276 uses_polling = False, 277 deps = [":helpers"], 278) 279 280grpc_cc_test( 281 name = "bm_chttp2_hpack", 282 srcs = ["bm_chttp2_hpack.cc"], 283 args = grpc_benchmark_args(), 284 tags = [ 285 "no_mac", 286 "no_windows", 287 ], 288 uses_polling = False, 289 deps = [":helpers"], 290) 291 292grpc_cc_test( 293 name = "bm_chttp2_transport", 294 srcs = ["bm_chttp2_transport.cc"], 295 args = grpc_benchmark_args(), 296 tags = [ 297 "no_mac", 298 "no_windows", 299 "nomsan", 300 ], 301 deps = [":helpers"], 302) 303 304grpc_cc_test( 305 name = "bm_opencensus_plugin", 306 srcs = ["bm_opencensus_plugin.cc"], 307 args = grpc_benchmark_args(), 308 language = "C++", 309 deps = [ 310 ":helpers_secure", 311 "//:grpc_opencensus_plugin", 312 "//src/proto/grpc/testing:echo_proto", 313 ], 314) 315 316grpc_cc_test( 317 name = "bm_timer", 318 srcs = ["bm_timer.cc"], 319 args = grpc_benchmark_args(), 320 tags = [ 321 "no_mac", 322 "no_windows", 323 ], 324 uses_polling = False, 325 deps = [":helpers"], 326) 327 328grpc_cc_test( 329 name = "bm_pollset", 330 srcs = ["bm_pollset.cc"], 331 args = grpc_benchmark_args(), 332 tags = [ 333 "no_mac", 334 "no_windows", 335 ], 336 deps = [":helpers"], 337) 338 339grpc_cc_test( 340 name = "bm_threadpool", 341 size = "large", 342 srcs = ["bm_threadpool.cc"], 343 args = grpc_benchmark_args(), 344 tags = [ 345 "manual", 346 "no_windows", 347 "notap", 348 ], 349 uses_polling = False, 350 deps = [":helpers"], 351) 352 353grpc_cc_library( 354 name = "bm_callback_test_service_impl", 355 testonly = 1, 356 srcs = ["callback_test_service.cc"], 357 hdrs = ["callback_test_service.h"], 358 external_deps = [ 359 "benchmark", 360 ], 361 deps = [ 362 ":helpers", 363 "//src/proto/grpc/testing:echo_proto", 364 "//test/cpp/util:test_util_unsecure", 365 ], 366) 367 368grpc_cc_library( 369 name = "callback_unary_ping_pong_h", 370 testonly = 1, 371 hdrs = [ 372 "callback_unary_ping_pong.h", 373 ], 374 deps = [ 375 ":bm_callback_test_service_impl", 376 ":helpers", 377 ], 378) 379 380grpc_cc_test( 381 name = "bm_callback_unary_ping_pong", 382 size = "large", 383 srcs = [ 384 "bm_callback_unary_ping_pong.cc", 385 ], 386 args = grpc_benchmark_args(), 387 tags = [ 388 "manual", 389 "no_mac", 390 "no_windows", 391 "notap", 392 ], 393 deps = [":callback_unary_ping_pong_h"], 394) 395 396grpc_cc_library( 397 name = "callback_streaming_ping_pong_h", 398 testonly = 1, 399 hdrs = [ 400 "callback_streaming_ping_pong.h", 401 ], 402 deps = [ 403 ":bm_callback_test_service_impl", 404 ":helpers", 405 ], 406) 407 408grpc_cc_test( 409 name = "bm_callback_streaming_ping_pong", 410 size = "large", 411 srcs = [ 412 "bm_callback_streaming_ping_pong.cc", 413 ], 414 args = grpc_benchmark_args(), 415 tags = [ 416 "manual", 417 "no_mac", 418 "no_windows", 419 "notap", 420 ], 421 deps = [":callback_streaming_ping_pong_h"], 422) 423