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