Merge bm_callback_cq to bm_cq

pull/18881/head
Na-Na Pang 6 years ago
parent 3fc702510f
commit 070902b871
  1. 62
      CMakeLists.txt
  2. 81
      Makefile
  3. 29
      build.yaml
  4. 2
      grpc.gyp
  5. 11
      test/cpp/microbenchmarks/BUILD
  6. 226
      test/cpp/microbenchmarks/bm_callback_cq.cc
  7. 50
      test/cpp/microbenchmarks/bm_cq.cc
  8. 27
      tools/run_tests/generated/sources_and_headers.json
  9. 26
      tools/run_tests/generated/tests.json

@ -556,9 +556,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx bm_call_create)
endif()
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx bm_callback_cq)
endif()
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx bm_callback_streaming_ping_pong)
endif()
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
@ -2918,7 +2915,7 @@ endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
if (gRPC_BUILD_CODEGEN)
add_library(callback_test_service
add_library(bm_callback_test_service_impl
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.grpc.pb.cc
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.pb.h
@ -2928,11 +2925,11 @@ add_library(callback_test_service
)
if(WIN32 AND MSVC)
set_target_properties(callback_test_service PROPERTIES COMPILE_PDB_NAME "callback_test_service"
set_target_properties(bm_callback_test_service_impl PROPERTIES COMPILE_PDB_NAME "bm_callback_test_service_impl"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
if (gRPC_INSTALL)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/callback_test_service.pdb
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bm_callback_test_service_impl.pdb
DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL
)
endif()
@ -2942,7 +2939,7 @@ protobuf_generate_grpc_cpp(
src/proto/grpc/testing/echo.proto
)
target_include_directories(callback_test_service
target_include_directories(bm_callback_test_service_impl
PUBLIC $<INSTALL_INTERFACE:${gRPC_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
@ -2959,7 +2956,7 @@ target_include_directories(callback_test_service
PRIVATE third_party/googletest/googlemock
PRIVATE ${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(callback_test_service
target_link_libraries(bm_callback_test_service_impl
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_benchmark
@ -11567,51 +11564,6 @@ target_link_libraries(bm_call_create
)
endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(bm_callback_cq
test/cpp/microbenchmarks/bm_callback_cq.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)
target_include_directories(bm_callback_cq
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR}
PRIVATE third_party/googletest/googletest/include
PRIVATE third_party/googletest/googletest
PRIVATE third_party/googletest/googlemock/include
PRIVATE third_party/googletest/googlemock
PRIVATE ${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(bm_callback_cq
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_benchmark
${_gRPC_BENCHMARK_LIBRARIES}
grpc++_test_util_unsecure
grpc_test_util_unsecure
grpc++_unsecure
grpc_unsecure
gpr
grpc++_test_config
${_gRPC_GFLAGS_LIBRARIES}
)
endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
@ -11653,7 +11605,7 @@ target_link_libraries(bm_callback_streaming_ping_pong
grpc_unsecure
gpr
grpc++_test_config
callback_test_service
bm_callback_test_service_impl
${_gRPC_GFLAGS_LIBRARIES}
)
@ -11699,7 +11651,7 @@ target_link_libraries(bm_callback_unary_ping_pong
grpc_unsecure
gpr
grpc++_test_config
callback_test_service
bm_callback_test_service_impl
${_gRPC_GFLAGS_LIBRARIES}
)

@ -1162,7 +1162,6 @@ bm_alarm: $(BINDIR)/$(CONFIG)/bm_alarm
bm_arena: $(BINDIR)/$(CONFIG)/bm_arena
bm_byte_buffer: $(BINDIR)/$(CONFIG)/bm_byte_buffer
bm_call_create: $(BINDIR)/$(CONFIG)/bm_call_create
bm_callback_cq: $(BINDIR)/$(CONFIG)/bm_callback_cq
bm_callback_streaming_ping_pong: $(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong
bm_callback_unary_ping_pong: $(BINDIR)/$(CONFIG)/bm_callback_unary_ping_pong
bm_channel: $(BINDIR)/$(CONFIG)/bm_channel
@ -1643,7 +1642,6 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/bm_arena \
$(BINDIR)/$(CONFIG)/bm_byte_buffer \
$(BINDIR)/$(CONFIG)/bm_call_create \
$(BINDIR)/$(CONFIG)/bm_callback_cq \
$(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong \
$(BINDIR)/$(CONFIG)/bm_callback_unary_ping_pong \
$(BINDIR)/$(CONFIG)/bm_channel \
@ -1792,7 +1790,6 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/bm_arena \
$(BINDIR)/$(CONFIG)/bm_byte_buffer \
$(BINDIR)/$(CONFIG)/bm_call_create \
$(BINDIR)/$(CONFIG)/bm_callback_cq \
$(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong \
$(BINDIR)/$(CONFIG)/bm_callback_unary_ping_pong \
$(BINDIR)/$(CONFIG)/bm_channel \
@ -2247,8 +2244,6 @@ test_cxx: buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/bm_byte_buffer || ( echo test bm_byte_buffer failed ; exit 1 )
$(E) "[RUN] Testing bm_call_create"
$(Q) $(BINDIR)/$(CONFIG)/bm_call_create || ( echo test bm_call_create failed ; exit 1 )
$(E) "[RUN] Testing bm_callback_cq"
$(Q) $(BINDIR)/$(CONFIG)/bm_callback_cq || ( echo test bm_callback_cq failed ; exit 1 )
$(E) "[RUN] Testing bm_callback_streaming_ping_pong"
$(Q) $(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong || ( echo test bm_callback_streaming_ping_pong failed ; exit 1 )
$(E) "[RUN] Testing bm_callback_unary_ping_pong"
@ -5305,21 +5300,21 @@ endif
endif
LIBCALLBACK_TEST_SERVICE_SRC = \
LIBBM_CALLBACK_TEST_SERVICE_IMPL_SRC = \
$(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc \
test/cpp/microbenchmarks/callback_test_service.cc \
PUBLIC_HEADERS_CXX += \
LIBCALLBACK_TEST_SERVICE_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBCALLBACK_TEST_SERVICE_SRC))))
LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_SRC))))
$(LIBCALLBACK_TEST_SERVICE_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX
$(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX
ifeq ($(NO_SECURE),true)
# You can't build secure libraries if you don't have OpenSSL.
$(LIBDIR)/$(CONFIG)/libcallback_test_service.a: openssl_dep_error
$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: openssl_dep_error
else
@ -5328,18 +5323,18 @@ ifeq ($(NO_PROTOBUF),true)
# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay.
$(LIBDIR)/$(CONFIG)/libcallback_test_service.a: protobuf_dep_error
$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: protobuf_dep_error
else
$(LIBDIR)/$(CONFIG)/libcallback_test_service.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBCALLBACK_TEST_SERVICE_OBJS)
$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS)
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libcallback_test_service.a
$(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libcallback_test_service.a $(LIBCALLBACK_TEST_SERVICE_OBJS)
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a
$(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS)
ifeq ($(SYSTEM),Darwin)
$(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libcallback_test_service.a
$(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a
endif
@ -5351,7 +5346,7 @@ endif
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(LIBCALLBACK_TEST_SERVICE_OBJS:.o=.dep)
-include $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS:.o=.dep)
endif
endif
$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/callback_test_service.o: $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc
@ -14500,50 +14495,6 @@ endif
endif
BM_CALLBACK_CQ_SRC = \
test/cpp/microbenchmarks/bm_callback_cq.cc \
BM_CALLBACK_CQ_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(BM_CALLBACK_CQ_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/bm_callback_cq: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+.
$(BINDIR)/$(CONFIG)/bm_callback_cq: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/bm_callback_cq: $(PROTOBUF_DEP) $(BM_CALLBACK_CQ_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(BM_CALLBACK_CQ_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_callback_cq
endif
endif
$(BM_CALLBACK_CQ_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX
$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_callback_cq.o: $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
deps_bm_callback_cq: $(BM_CALLBACK_CQ_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(BM_CALLBACK_CQ_OBJS:.o=.dep)
endif
endif
BM_CALLBACK_STREAMING_PING_PONG_SRC = \
test/cpp/microbenchmarks/bm_callback_streaming_ping_pong.cc \
@ -14567,17 +14518,17 @@ $(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong: $(PROTOBUF_DEP) $(BM_CALLBACK_STREAMING_PING_PONG_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libcallback_test_service.a
$(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong: $(PROTOBUF_DEP) $(BM_CALLBACK_STREAMING_PING_PONG_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(BM_CALLBACK_STREAMING_PING_PONG_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libcallback_test_service.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong
$(Q) $(LDXX) $(LDFLAGS) $(BM_CALLBACK_STREAMING_PING_PONG_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_callback_streaming_ping_pong
endif
endif
$(BM_CALLBACK_STREAMING_PING_PONG_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX
$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_callback_streaming_ping_pong.o: $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libcallback_test_service.a
$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_callback_streaming_ping_pong.o: $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a
deps_bm_callback_streaming_ping_pong: $(BM_CALLBACK_STREAMING_PING_PONG_OBJS:.o=.dep)
@ -14611,17 +14562,17 @@ $(BINDIR)/$(CONFIG)/bm_callback_unary_ping_pong: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/bm_callback_unary_ping_pong: $(PROTOBUF_DEP) $(BM_CALLBACK_UNARY_PING_PONG_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libcallback_test_service.a
$(BINDIR)/$(CONFIG)/bm_callback_unary_ping_pong: $(PROTOBUF_DEP) $(BM_CALLBACK_UNARY_PING_PONG_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(BM_CALLBACK_UNARY_PING_PONG_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libcallback_test_service.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_callback_unary_ping_pong
$(Q) $(LDXX) $(LDFLAGS) $(BM_CALLBACK_UNARY_PING_PONG_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_callback_unary_ping_pong
endif
endif
$(BM_CALLBACK_UNARY_PING_PONG_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX
$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_callback_unary_ping_pong.o: $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libcallback_test_service.a
$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_callback_unary_ping_pong.o: $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a
deps_bm_callback_unary_ping_pong: $(BM_CALLBACK_UNARY_PING_PONG_OBJS:.o=.dep)

@ -1677,7 +1677,7 @@ libs:
- grpc_test_util
- grpc
- gpr
- name: callback_test_service
- name: bm_callback_test_service_impl
build: test
language: c++
headers:
@ -4054,29 +4054,6 @@ targets:
- linux
- posix
uses_polling: false
- name: bm_callback_cq
build: test
language: c++
src:
- test/cpp/microbenchmarks/bm_callback_cq.cc
deps:
- grpc_benchmark
- benchmark
- grpc++_test_util_unsecure
- grpc_test_util_unsecure
- grpc++_unsecure
- grpc_unsecure
- gpr
- grpc++_test_config
benchmark: true
defaults: benchmark
excluded_poll_engines:
- poll
platforms:
- mac
- linux
- posix
timeout_seconds: 1200
- name: bm_callback_streaming_ping_pong
build: test
language: c++
@ -4093,7 +4070,7 @@ targets:
- grpc_unsecure
- gpr
- grpc++_test_config
- callback_test_service
- bm_callback_test_service_impl
benchmark: true
defaults: benchmark
platforms:
@ -4116,7 +4093,7 @@ targets:
- grpc_unsecure
- gpr
- grpc++_test_config
- callback_test_service
- bm_callback_test_service_impl
benchmark: true
defaults: benchmark
platforms:

@ -1406,7 +1406,7 @@
],
},
{
'target_name': 'callback_test_service',
'target_name': 'bm_callback_test_service_impl',
'type': 'static_library',
'dependencies': [
'grpc_benchmark',

@ -281,14 +281,3 @@ grpc_cc_binary(
tags = ["no_windows"],
deps = [":callback_streaming_ping_pong_h"],
)
grpc_cc_binary(
name = "bm_callback_cq",
testonly = 1,
srcs = ["bm_callback_cq.cc"],
language = "C++",
deps = [
":helpers",
"//test/cpp/util:test_util",
],
)

@ -1,226 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/* This benchmark exists to ensure that immediately-firing alarms are fast */
#include <benchmark/benchmark.h>
#include <grpc/grpc.h>
#include <grpcpp/alarm.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/grpc_library.h>
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/surface/completion_queue.h"
namespace grpc {
namespace testing {
class TagCallback : public grpc_experimental_completion_queue_functor {
public:
TagCallback(int* counter, int tag) : counter_(counter), tag_(tag) {
functor_run = &TagCallback::Run;
}
~TagCallback() {}
static void Run(grpc_experimental_completion_queue_functor* cb, int ok) {
GPR_ASSERT(static_cast<bool>(ok));
auto* callback = static_cast<TagCallback*>(cb);
*callback->counter_ += callback->tag_;
grpc_core::Delete(callback);
};
private:
int* counter_;
int tag_;
};
class ShutdownCallback : public grpc_experimental_completion_queue_functor {
public:
ShutdownCallback(bool* done) : done_(done) {
functor_run = &ShutdownCallback::Run;
}
~ShutdownCallback() {}
static void Run(grpc_experimental_completion_queue_functor* cb, int ok) {
*static_cast<ShutdownCallback*>(cb)->done_ = static_cast<bool>(ok);
}
private:
bool* done_;
};
/* helper for tests to shutdown correctly and tersely */
static void shutdown_and_destroy(grpc_completion_queue* cc) {
grpc_completion_queue_shutdown(cc);
grpc_completion_queue_destroy(cc);
}
static void do_nothing_end_completion(void* arg, grpc_cq_completion* c) {}
static void BM_Callback_CQ_Default_Polling(benchmark::State& state) {
int tag_size = state.range(0);
grpc_completion_queue* cc;
void* tags[tag_size];
grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)];
grpc_completion_queue_attributes attr;
unsigned i;
bool got_shutdown = false;
ShutdownCallback shutdown_cb(&got_shutdown);
attr.version = 2;
attr.cq_completion_type = GRPC_CQ_CALLBACK;
attr.cq_shutdown_cb = &shutdown_cb;
while (state.KeepRunning()) {
int sumtags = 0;
int counter = 0;
{
// reset exec_ctx types
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
grpc_core::ExecCtx exec_ctx;
attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING;
cc = grpc_completion_queue_create(
grpc_completion_queue_factory_lookup(&attr), &attr, nullptr);
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
tags[i] = static_cast<void*>(grpc_core::New<TagCallback>(&counter, i));
sumtags += i;
}
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
GPR_ASSERT(grpc_cq_begin_op(cc, tags[i]));
grpc_cq_end_op(cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion,
nullptr, &completions[i]);
}
shutdown_and_destroy(cc);
}
GPR_ASSERT(sumtags == counter);
GPR_ASSERT(got_shutdown);
got_shutdown = false;
}
}
BENCHMARK(BM_Callback_CQ_Default_Polling)->Range(1, 128 * 1024);
static void BM_Callback_CQ_Non_Listening(benchmark::State& state) {
int tag_size = state.range(0);
grpc_completion_queue* cc;
void* tags[tag_size];
grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)];
grpc_completion_queue_attributes attr;
unsigned i;
bool got_shutdown = false;
ShutdownCallback shutdown_cb(&got_shutdown);
attr.version = 2;
attr.cq_completion_type = GRPC_CQ_CALLBACK;
attr.cq_shutdown_cb = &shutdown_cb;
while (state.KeepRunning()) {
int sumtags = 0;
int counter = 0;
{
// reset exec_ctx types
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
grpc_core::ExecCtx exec_ctx;
attr.cq_polling_type = GRPC_CQ_NON_LISTENING;
cc = grpc_completion_queue_create(
grpc_completion_queue_factory_lookup(&attr), &attr, nullptr);
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
tags[i] = static_cast<void*>(grpc_core::New<TagCallback>(&counter, i));
sumtags += i;
}
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
GPR_ASSERT(grpc_cq_begin_op(cc, tags[i]));
grpc_cq_end_op(cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion,
nullptr, &completions[i]);
}
shutdown_and_destroy(cc);
}
GPR_ASSERT(sumtags == counter);
GPR_ASSERT(got_shutdown);
got_shutdown = false;
}
}
BENCHMARK(BM_Callback_CQ_Non_Listening)->Range(1, 128 * 1024);
static void BM_Callback_CQ_Non_Polling(benchmark::State& state) {
int tag_size = state.range(0);
grpc_completion_queue* cc;
void* tags[tag_size];
grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)];
grpc_completion_queue_attributes attr;
unsigned i;
bool got_shutdown = false;
ShutdownCallback shutdown_cb(&got_shutdown);
attr.version = 2;
attr.cq_completion_type = GRPC_CQ_CALLBACK;
attr.cq_shutdown_cb = &shutdown_cb;
while (state.KeepRunning()) {
int sumtags = 0;
int counter = 0;
{
// reset exec_ctx types
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
grpc_core::ExecCtx exec_ctx;
attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING;
cc = grpc_completion_queue_create(
grpc_completion_queue_factory_lookup(&attr), &attr, nullptr);
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
tags[i] = static_cast<void*>(grpc_core::New<TagCallback>(&counter, i));
sumtags += i;
}
for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) {
GPR_ASSERT(grpc_cq_begin_op(cc, tags[i]));
grpc_cq_end_op(cc, tags[i], GRPC_ERROR_NONE, do_nothing_end_completion,
nullptr, &completions[i]);
}
shutdown_and_destroy(cc);
}
GPR_ASSERT(sumtags == counter);
GPR_ASSERT(got_shutdown);
got_shutdown = false;
}
}
BENCHMARK(BM_Callback_CQ_Non_Polling)->Range(1, 128 * 1024);
} // namespace testing
} // namespace grpc
// Some distros have RunSpecifiedBenchmarks under the benchmark namespace,
// and others do not. This allows us to support both modes.
namespace benchmark {
void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);
benchmark::RunTheBenchmarksNamespaced();
return 0;
}

@ -144,6 +144,56 @@ static void BM_EmptyCore(benchmark::State& state) {
}
BENCHMARK(BM_EmptyCore);
// helper for tests to shutdown correctly and tersely
static void shutdown_and_destroy(grpc_completion_queue* cc) {
grpc_completion_queue_shutdown(cc);
grpc_completion_queue_destroy(cc);
}
class TagCallback : public grpc_experimental_completion_queue_functor {
public:
TagCallback() { functor_run = &TagCallback::Run; }
~TagCallback() {}
static void Run(grpc_experimental_completion_queue_functor* cb, int ok) {
GPR_ASSERT(static_cast<bool>(ok));
};
};
class ShutdownCallback : public grpc_experimental_completion_queue_functor {
public:
ShutdownCallback(bool* done) : done_(done) {
functor_run = &ShutdownCallback::Run;
}
~ShutdownCallback() {}
static void Run(grpc_experimental_completion_queue_functor* cb, int ok) {
*static_cast<ShutdownCallback*>(cb)->done_ = static_cast<bool>(ok);
}
private:
bool* done_;
};
static void BM_Callback_CQ_Pass1Core(benchmark::State& state) {
TrackCounters track_counters;
TagCallback tag;
bool got_shutdown = false;
ShutdownCallback shutdown_cb(&got_shutdown);
grpc_completion_queue* cc =
grpc_completion_queue_create_for_callback(&shutdown_cb, nullptr);
while (state.KeepRunning()) {
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
grpc_core::ExecCtx exec_ctx;
grpc_cq_completion completion;
GPR_ASSERT(grpc_cq_begin_op(cc, &tag));
grpc_cq_end_op(cc, &tag, GRPC_ERROR_NONE, DoneWithCompletionOnStack,
nullptr, &completion);
}
shutdown_and_destroy(cc);
GPR_ASSERT(got_shutdown);
track_counters.Finish(state);
}
BENCHMARK(BM_Callback_CQ_Pass1Core);
} // namespace testing
} // namespace grpc

@ -2779,28 +2779,7 @@
{
"deps": [
"benchmark",
"gpr",
"grpc++_test_config",
"grpc++_test_util_unsecure",
"grpc++_unsecure",
"grpc_benchmark",
"grpc_test_util_unsecure",
"grpc_unsecure"
],
"headers": [],
"is_filegroup": false,
"language": "c++",
"name": "bm_callback_cq",
"src": [
"test/cpp/microbenchmarks/bm_callback_cq.cc"
],
"third_party": false,
"type": "target"
},
{
"deps": [
"benchmark",
"callback_test_service",
"bm_callback_test_service_impl",
"gpr",
"grpc++_test_config",
"grpc++_test_util_unsecure",
@ -2825,7 +2804,7 @@
{
"deps": [
"benchmark",
"callback_test_service",
"bm_callback_test_service_impl",
"gpr",
"grpc++_test_config",
"grpc++_test_util_unsecure",
@ -6693,7 +6672,7 @@
],
"is_filegroup": false,
"language": "c++",
"name": "callback_test_service",
"name": "bm_callback_test_service_impl",
"src": [
"test/cpp/microbenchmarks/callback_test_service.cc",
"test/cpp/microbenchmarks/callback_test_service.h"

@ -3479,32 +3479,6 @@
],
"uses_polling": false
},
{
"args": [],
"benchmark": true,
"ci_platforms": [
"linux",
"mac",
"posix"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"excluded_poll_engines": [
"poll"
],
"flaky": false,
"gtest": false,
"language": "c++",
"name": "bm_callback_cq",
"platforms": [
"linux",
"mac",
"posix"
],
"timeout_seconds": 1200,
"uses_polling": true
},
{
"args": [],
"benchmark": true,

Loading…
Cancel
Save