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:custom_exec_properties.bzl", "LARGE_MACHINE") 16load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package", "grpc_py_binary") 17load("//test/cpp/qps:qps_benchmark_script.bzl", "json_run_localhost_batch", "qps_json_driver_batch") 18 19licenses(["notice"]) 20 21grpc_package(name = "test/cpp/qps") 22 23grpc_cc_library( 24 name = "parse_json", 25 srcs = ["parse_json.cc"], 26 hdrs = ["parse_json.h"], 27 external_deps = [ 28 "absl/log:check", 29 "protobuf", 30 ], 31 deps = ["//:grpc++"], 32) 33 34grpc_cc_library( 35 name = "qps_worker_impl", 36 srcs = [ 37 "client_async.cc", 38 "client_callback.cc", 39 "client_sync.cc", 40 "qps_server_builder.cc", 41 "qps_worker.cc", 42 "server_async.cc", 43 "server_callback.cc", 44 "server_sync.cc", 45 ], 46 hdrs = [ 47 "client.h", 48 "qps_server_builder.h", 49 "qps_worker.h", 50 "server.h", 51 ], 52 external_deps = ["absl/log:check"], 53 deps = [ 54 ":histogram", 55 ":interarrival", 56 ":usage_timer", 57 "//:grpc", 58 "//:grpc++", 59 "//src/proto/grpc/testing:benchmark_service_cc_grpc", 60 "//src/proto/grpc/testing:control_cc_proto", 61 "//src/proto/grpc/testing:payloads_cc_proto", 62 "//src/proto/grpc/testing:worker_service_cc_grpc", 63 "//test/core/end2end:ssl_test_data", 64 "//test/core/test_util:grpc_test_util", 65 "//test/cpp/util:test_config", 66 "//test/cpp/util:test_util", 67 ], 68) 69 70grpc_cc_library( 71 name = "driver_impl", 72 srcs = [ 73 "driver.cc", 74 "report.cc", 75 ], 76 hdrs = [ 77 "driver.h", 78 "report.h", 79 ], 80 external_deps = [ 81 "absl/log:check", 82 "absl/log:log", 83 ], 84 deps = [ 85 ":histogram", 86 ":parse_json", 87 ":qps_worker_impl", 88 "//:grpc++", 89 "//src/proto/grpc/testing:control_cc_proto", 90 "//src/proto/grpc/testing:messages_cc_proto", 91 "//src/proto/grpc/testing:report_qps_scenario_service_cc_grpc", 92 "//src/proto/grpc/testing:worker_service_cc_grpc", 93 "//test/core/test_util:grpc_test_util", 94 "//test/cpp/util:test_util", 95 ], 96) 97 98grpc_cc_library( 99 name = "benchmark_config", 100 srcs = [ 101 "benchmark_config.cc", 102 ], 103 hdrs = [ 104 "benchmark_config.h", 105 ], 106 external_deps = [ 107 "absl/flags:flag", 108 "absl/log:check", 109 ], 110 deps = [ 111 ":driver_impl", 112 ":histogram", 113 "//:grpc++", 114 "//src/proto/grpc/testing:control_cc_proto", 115 ], 116) 117 118grpc_cc_library( 119 name = "histogram", 120 hdrs = [ 121 "histogram.h", 122 "stats.h", 123 ], 124 deps = [ 125 "//src/proto/grpc/testing:stats_cc_proto", 126 "//test/core/test_util:grpc_test_util", 127 ], 128) 129 130grpc_cc_binary( 131 name = "qps_json_driver", 132 srcs = ["qps_json_driver.cc"], 133 external_deps = [ 134 "absl/flags:flag", 135 "absl/log:check", 136 ], 137 deps = [ 138 ":benchmark_config", 139 ":driver_impl", 140 "//:grpc++", 141 "//test/cpp/util:test_config", 142 "//test/cpp/util:test_util", 143 ], 144) 145 146grpc_cc_test( 147 name = "inproc_sync_unary_ping_pong_test", 148 srcs = ["inproc_sync_unary_ping_pong_test.cc"], 149 deps = [ 150 ":benchmark_config", 151 ":driver_impl", 152 "//:grpc++", 153 "//test/cpp/util:test_config", 154 "//test/cpp/util:test_util", 155 ], 156) 157 158grpc_cc_library( 159 name = "interarrival", 160 hdrs = ["interarrival.h"], 161 deps = ["//:grpc++"], 162) 163 164qps_json_driver_batch() 165 166json_run_localhost_batch() 167 168grpc_cc_test( 169 name = "qps_interarrival_test", 170 srcs = ["qps_interarrival_test.cc"], 171 uses_event_engine = False, 172 uses_polling = False, 173 deps = [ 174 ":histogram", 175 ":interarrival", 176 "//test/core/test_util:grpc_test_util_base", 177 "//test/cpp/util:test_config", 178 ], 179) 180 181grpc_cc_test( 182 name = "qps_openloop_test", 183 srcs = ["qps_openloop_test.cc"], 184 exec_properties = LARGE_MACHINE, 185 tags = ["no_windows"], # LARGE_MACHINE is not configured for windows RBE 186 deps = [ 187 ":benchmark_config", 188 ":driver_impl", 189 ":qps_worker_impl", 190 "//test/cpp/util:test_config", 191 "//test/cpp/util:test_util", 192 ], 193) 194 195grpc_cc_test( 196 name = "secure_sync_unary_ping_pong_test", 197 srcs = ["secure_sync_unary_ping_pong_test.cc"], 198 deps = [ 199 ":benchmark_config", 200 ":driver_impl", 201 "//:grpc++", 202 "//test/cpp/util:test_config", 203 "//test/cpp/util:test_util", 204 ], 205) 206 207grpc_cc_library( 208 name = "usage_timer", 209 srcs = ["usage_timer.cc"], 210 hdrs = ["usage_timer.h"], 211 deps = ["//:gpr"], 212) 213 214grpc_cc_binary( 215 name = "qps_worker", 216 srcs = ["worker.cc"], 217 external_deps = [ 218 "absl/flags:flag", 219 ], 220 deps = [ 221 ":qps_worker_impl", 222 "//:grpc++", 223 "//test/core/test_util:grpc_test_util", 224 "//test/cpp/util:test_config", 225 "//test/cpp/util:test_util", 226 ], 227) 228 229grpc_py_binary( 230 name = "scenario_runner", 231 testonly = True, 232 srcs = ["scenario_runner.py"], 233 data = ["scenario_runner_cc"], 234 python_version = "PY3", 235) 236 237grpc_cc_binary( 238 name = "scenario_runner_cc", 239 srcs = ["scenario_runner.cc"], 240 external_deps = [ 241 "absl/flags:flag", 242 ], 243 deps = [ 244 ":benchmark_config", 245 ":driver_impl", 246 "//:grpc++", 247 "//test/core/test_util:grpc_test_util", 248 "//test/cpp/util:test_config", 249 "//test/cpp/util:test_util", 250 ], 251) 252