aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-03-05 15:45:46 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-03-05 15:45:46 -0800
commit68de8e91cc8e991b7f70c0ce988dcc8e1488a187 (patch)
tree9870605ed36886b10ffc50d9b7af23280bebcf25
parent0642863b7338e031ae3ab34aede53a2f764380fd (diff)
parent2f364c0bb00b07e7f841809d266d53ab5c18b358 (diff)
Merge github.com:grpc/grpc into credit
-rw-r--r--Makefile208
-rw-r--r--build.json68
-rw-r--r--include/grpc/support/histogram.h10
-rw-r--r--src/compiler/python_plugin.cc1
-rw-r--r--src/core/iomgr/resolve_address_posix.c15
-rw-r--r--src/core/support/histogram.c35
-rw-r--r--src/core/surface/call.c2
-rw-r--r--src/node/binding.gyp30
-rw-r--r--src/node/ext/byte_buffer.cc17
-rw-r--r--src/node/ext/call.cc55
-rw-r--r--src/node/ext/call.h10
-rw-r--r--src/node/ext/channel.cc14
-rw-r--r--src/node/ext/channel.h2
-rw-r--r--src/node/ext/credentials.cc56
-rw-r--r--src/node/ext/credentials.h2
-rw-r--r--src/node/ext/node_grpc.cc6
-rw-r--r--src/node/ext/server.cc27
-rw-r--r--src/node/ext/server.h2
-rw-r--r--src/node/ext/server_credentials.cc40
-rw-r--r--src/node/ext/server_credentials.h2
-rw-r--r--src/node/package.json13
-rw-r--r--src/ruby/ext/grpc/extconf.rb1
-rw-r--r--src/ruby/ext/grpc/rb_grpc.c6
-rw-r--r--test/core/network_benchmarks/low_level_ping_pong.c10
-rw-r--r--test/core/util/grpc_profiler.c2
-rw-r--r--test/cpp/qps/client.cc252
-rw-r--r--test/cpp/qps/client.h173
-rw-r--r--test/cpp/qps/client_async.cc306
-rw-r--r--test/cpp/qps/client_sync.cc93
-rw-r--r--test/cpp/qps/driver.cc210
-rw-r--r--test/cpp/qps/driver.h61
-rw-r--r--test/cpp/qps/histogram.h85
-rw-r--r--test/cpp/qps/qps_driver.cc132
-rw-r--r--test/cpp/qps/qpstest.proto96
-rw-r--r--test/cpp/qps/server.h84
-rw-r--r--test/cpp/qps/server_async.cc147
-rw-r--r--test/cpp/qps/server_sync.cc108
-rwxr-xr-xtest/cpp/qps/single_run_localhost.sh28
-rw-r--r--test/cpp/qps/stats.h60
-rw-r--r--test/cpp/qps/timer.cc71
-rw-r--r--test/cpp/qps/timer.h57
-rw-r--r--test/cpp/qps/worker.cc236
-rwxr-xr-xtools/gce_setup/cloud_prod_runner.sh2
-rwxr-xr-xtools/gce_setup/interop_test_runner.sh5
-rwxr-xr-xtools/run_tests/build_node.sh8
-rwxr-xr-xtools/run_tests/jobset.py6
-rwxr-xr-xtools/run_tests/python_tests.json18
-rwxr-xr-xtools/run_tests/run_node.sh4
-rwxr-xr-xtools/run_tests/run_python.sh22
-rwxr-xr-xtools/run_tests/run_tests.py91
50 files changed, 1999 insertions, 990 deletions
diff --git a/Makefile b/Makefile
index 470cdf539d..61676c2ce1 100644
--- a/Makefile
+++ b/Makefile
@@ -544,10 +544,8 @@ interop_test: $(BINDIR)/$(CONFIG)/interop_test
pubsub_client: $(BINDIR)/$(CONFIG)/pubsub_client
pubsub_publisher_test: $(BINDIR)/$(CONFIG)/pubsub_publisher_test
pubsub_subscriber_test: $(BINDIR)/$(CONFIG)/pubsub_subscriber_test
-qps_client: $(BINDIR)/$(CONFIG)/qps_client
-qps_client_async: $(BINDIR)/$(CONFIG)/qps_client_async
-qps_server: $(BINDIR)/$(CONFIG)/qps_server
-qps_server_async: $(BINDIR)/$(CONFIG)/qps_server_async
+qps_driver: $(BINDIR)/$(CONFIG)/qps_driver
+qps_worker: $(BINDIR)/$(CONFIG)/qps_worker
status_test: $(BINDIR)/$(CONFIG)/status_test
thread_pool_test: $(BINDIR)/$(CONFIG)/thread_pool_test
chttp2_fake_security_bad_hostname_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test
@@ -961,13 +959,13 @@ privatelibs: privatelibs_c privatelibs_cxx
privatelibs_c: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_bad_hostname.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags.a $(LIBDIR)/$(CONFIG)/libend2end_test_empty_batch.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_thread_stress.a $(LIBDIR)/$(CONFIG)/libend2end_test_writes_done_hangs_with_pending_read.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_thread_stress_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_writes_done_hangs_with_pending_read_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a
-privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.a
+privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.a $(LIBDIR)/$(CONFIG)/libqps.a
buildtests: buildtests_c buildtests_cxx
buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/census_hash_table_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_test $(BINDIR)/$(CONFIG)/census_statistics_performance_test $(BINDIR)/$(CONFIG)/census_statistics_quick_test $(BINDIR)/$(CONFIG)/census_statistics_small_log_test $(BINDIR)/$(CONFIG)/census_stub_test $(BINDIR)/$(CONFIG)/census_window_stats_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/chttp2_transport_end2end_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/echo_client $(BINDIR)/$(CONFIG)/echo_server $(BINDIR)/$(CONFIG)/echo_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/metadata_buffer_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_legacy_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_legacy_test
-buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_client $(BINDIR)/$(CONFIG)/qps_client_async $(BINDIR)/$(CONFIG)/qps_server $(BINDIR)/$(CONFIG)/qps_server_async $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test
+buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/pubsub_client $(BINDIR)/$(CONFIG)/pubsub_publisher_test $(BINDIR)/$(CONFIG)/pubsub_subscriber_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test
test: test_c test_cxx
@@ -3520,6 +3518,68 @@ $(OBJDIR)/$(CONFIG)/examples/pubsub/publisher.o: $(GENDIR)/examples/pubsub/l
$(OBJDIR)/$(CONFIG)/examples/pubsub/subscriber.o: $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/pubsub.pb.cc
+LIBQPS_SRC = \
+ $(GENDIR)/test/cpp/qps/qpstest.pb.cc \
+ test/cpp/qps/driver.cc \
+ test/cpp/qps/timer.cc \
+
+
+LIBQPS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBQPS_SRC))))
+
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure libraries if you don't have OpenSSL with ALPN.
+
+$(LIBDIR)/$(CONFIG)/libqps.a: openssl_dep_error
+
+
+else
+
+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)/libqps.a: protobuf_dep_error
+
+
+else
+
+ifneq ($(OPENSSL_DEP),)
+# This is to ensure the embedded OpenSSL is built beforehand, properly
+# installing headers to their final destination on the drive. We need this
+# otherwise parallel compilation will fail if a source is compiled first.
+test/cpp/qps/qpstest.proto: $(OPENSSL_DEP)
+test/cpp/qps/driver.cc: $(OPENSSL_DEP)
+test/cpp/qps/timer.cc: $(OPENSSL_DEP)
+endif
+
+$(LIBDIR)/$(CONFIG)/libqps.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(PROTOBUF_DEP) $(LIBQPS_OBJS)
+ $(E) "[AR] Creating $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) rm -f $(LIBDIR)/$(CONFIG)/libqps.a
+ $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/libqps.a $(LIBQPS_OBJS)
+ifeq ($(SYSTEM),Darwin)
+ $(Q) ranlib $(LIBDIR)/$(CONFIG)/libqps.a
+endif
+
+
+
+
+endif
+
+endif
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(LIBQPS_OBJS:.o=.dep)
+endif
+endif
+
+
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/driver.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/timer.o: $(GENDIR)/test/cpp/qps/qpstest.pb.cc
+
+
LIBGRPC_CSHARP_EXT_SRC = \
src/csharp/ext/grpc_csharp_ext.c \
@@ -8230,17 +8290,16 @@ endif
endif
-QPS_CLIENT_SRC = \
- $(GENDIR)/test/cpp/qps/qpstest.pb.cc \
- test/cpp/qps/client.cc \
+QPS_DRIVER_SRC = \
+ test/cpp/qps/qps_driver.cc \
-QPS_CLIENT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_CLIENT_SRC))))
+QPS_DRIVER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_DRIVER_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL with ALPN.
-$(BINDIR)/$(CONFIG)/qps_client: openssl_dep_error
+$(BINDIR)/$(CONFIG)/qps_driver: openssl_dep_error
else
@@ -8249,130 +8308,44 @@ ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
-$(BINDIR)/$(CONFIG)/qps_client: protobuf_dep_error
+$(BINDIR)/$(CONFIG)/qps_driver: protobuf_dep_error
else
-$(BINDIR)/$(CONFIG)/qps_client: $(PROTOBUF_DEP) $(QPS_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(BINDIR)/$(CONFIG)/qps_driver: $(PROTOBUF_DEP) $(QPS_DRIVER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
- $(Q) $(LDXX) $(LDFLAGS) $(QPS_CLIENT_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_client
+ $(Q) $(LDXX) $(LDFLAGS) $(QPS_DRIVER_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_driver
endif
endif
-$(OBJDIR)/$(CONFIG)/test/cpp/qps/qpstest.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-$(OBJDIR)/$(CONFIG)/test/cpp/qps/client.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/qps_driver.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-deps_qps_client: $(QPS_CLIENT_OBJS:.o=.dep)
+deps_qps_driver: $(QPS_DRIVER_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
--include $(QPS_CLIENT_OBJS:.o=.dep)
+-include $(QPS_DRIVER_OBJS:.o=.dep)
endif
endif
-QPS_CLIENT_ASYNC_SRC = \
- $(GENDIR)/test/cpp/qps/qpstest.pb.cc \
+QPS_WORKER_SRC = \
test/cpp/qps/client_async.cc \
-
-QPS_CLIENT_ASYNC_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_CLIENT_ASYNC_SRC))))
-
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL with ALPN.
-
-$(BINDIR)/$(CONFIG)/qps_client_async: 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.0.0+.
-
-$(BINDIR)/$(CONFIG)/qps_client_async: protobuf_dep_error
-
-else
-
-$(BINDIR)/$(CONFIG)/qps_client_async: $(PROTOBUF_DEP) $(QPS_CLIENT_ASYNC_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
- $(E) "[LD] Linking $@"
- $(Q) mkdir -p `dirname $@`
- $(Q) $(LDXX) $(LDFLAGS) $(QPS_CLIENT_ASYNC_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_client_async
-
-endif
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/cpp/qps/qpstest.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-$(OBJDIR)/$(CONFIG)/test/cpp/qps/client_async.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_qps_client_async: $(QPS_CLIENT_ASYNC_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(QPS_CLIENT_ASYNC_OBJS:.o=.dep)
-endif
-endif
-
-
-QPS_SERVER_SRC = \
- $(GENDIR)/test/cpp/qps/qpstest.pb.cc \
- test/cpp/qps/server.cc \
-
-QPS_SERVER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_SERVER_SRC))))
-
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL with ALPN.
-
-$(BINDIR)/$(CONFIG)/qps_server: 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.0.0+.
-
-$(BINDIR)/$(CONFIG)/qps_server: protobuf_dep_error
-
-else
-
-$(BINDIR)/$(CONFIG)/qps_server: $(PROTOBUF_DEP) $(QPS_SERVER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
- $(E) "[LD] Linking $@"
- $(Q) mkdir -p `dirname $@`
- $(Q) $(LDXX) $(LDFLAGS) $(QPS_SERVER_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_server
-
-endif
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/cpp/qps/qpstest.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-$(OBJDIR)/$(CONFIG)/test/cpp/qps/server.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_qps_server: $(QPS_SERVER_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(QPS_SERVER_OBJS:.o=.dep)
-endif
-endif
-
-
-QPS_SERVER_ASYNC_SRC = \
- $(GENDIR)/test/cpp/qps/qpstest.pb.cc \
+ test/cpp/qps/client_sync.cc \
test/cpp/qps/server_async.cc \
+ test/cpp/qps/server_sync.cc \
+ test/cpp/qps/worker.cc \
-QPS_SERVER_ASYNC_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_SERVER_ASYNC_SRC))))
+QPS_WORKER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_WORKER_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL with ALPN.
-$(BINDIR)/$(CONFIG)/qps_server_async: openssl_dep_error
+$(BINDIR)/$(CONFIG)/qps_worker: openssl_dep_error
else
@@ -8381,27 +8354,30 @@ ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
-$(BINDIR)/$(CONFIG)/qps_server_async: protobuf_dep_error
+$(BINDIR)/$(CONFIG)/qps_worker: protobuf_dep_error
else
-$(BINDIR)/$(CONFIG)/qps_server_async: $(PROTOBUF_DEP) $(QPS_SERVER_ASYNC_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(BINDIR)/$(CONFIG)/qps_worker: $(PROTOBUF_DEP) $(QPS_WORKER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
- $(Q) $(LDXX) $(LDFLAGS) $(QPS_SERVER_ASYNC_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_server_async
+ $(Q) $(LDXX) $(LDFLAGS) $(QPS_WORKER_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_worker
endif
endif
-$(OBJDIR)/$(CONFIG)/test/cpp/qps/qpstest.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-$(OBJDIR)/$(CONFIG)/test/cpp/qps/server_async.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/client_async.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/client_sync.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/server_async.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/server_sync.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/worker.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-deps_qps_server_async: $(QPS_SERVER_ASYNC_OBJS:.o=.dep)
+deps_qps_worker: $(QPS_WORKER_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
--include $(QPS_SERVER_ASYNC_OBJS:.o=.dep)
+-include $(QPS_WORKER_OBJS:.o=.dep)
endif
endif
diff --git a/build.json b/build.json
index 928b2d1937..d65e865ff9 100644
--- a/build.json
+++ b/build.json
@@ -503,6 +503,20 @@
]
},
{
+ "name": "qps",
+ "build": "private",
+ "language": "c++",
+ "headers": [
+ "test/cpp/qps/driver.h",
+ "test/cpp/qps/timer.h"
+ ],
+ "src": [
+ "test/cpp/qps/qpstest.proto",
+ "test/cpp/qps/driver.cc",
+ "test/cpp/qps/timer.cc"
+ ]
+ },
+ {
"name": "grpc_csharp_ext",
"build": "all",
"language": "csharp",
@@ -1830,15 +1844,15 @@
]
},
{
- "name": "qps_client",
+ "name": "qps_driver",
"build": "test",
"run": false,
"language": "c++",
"src": [
- "test/cpp/qps/qpstest.proto",
- "test/cpp/qps/client.cc"
+ "test/cpp/qps/qps_driver.cc"
],
"deps": [
+ "qps",
"grpc++_test_util",
"grpc_test_util",
"grpc++",
@@ -1848,51 +1862,23 @@
]
},
{
- "name": "qps_client_async",
+ "name": "qps_worker",
"build": "test",
"run": false,
"language": "c++",
- "src": [
- "test/cpp/qps/qpstest.proto",
- "test/cpp/qps/client_async.cc"
- ],
- "deps": [
- "grpc++_test_util",
- "grpc_test_util",
- "grpc++",
- "grpc",
- "gpr_test_util",
- "gpr"
- ]
- },
- {
- "name": "qps_server",
- "build": "test",
- "run": false,
- "language": "c++",
- "src": [
- "test/cpp/qps/qpstest.proto",
- "test/cpp/qps/server.cc"
+ "headers": [
+ "test/cpp/qps/client.h",
+ "test/cpp/qps/server.h"
],
- "deps": [
- "grpc++_test_util",
- "grpc_test_util",
- "grpc++",
- "grpc",
- "gpr_test_util",
- "gpr"
- ]
- },
- {
- "name": "qps_server_async",
- "build": "test",
- "run": false,
- "language": "c++",
"src": [
- "test/cpp/qps/qpstest.proto",
- "test/cpp/qps/server_async.cc"
+ "test/cpp/qps/client_async.cc",
+ "test/cpp/qps/client_sync.cc",
+ "test/cpp/qps/server_async.cc",
+ "test/cpp/qps/server_sync.cc",
+ "test/cpp/qps/worker.cc"
],
"deps": [
+ "qps",
"grpc++_test_util",
"grpc_test_util",
"grpc++",
diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h
index 31f7fedfd5..64d08f0bf1 100644
--- a/include/grpc/support/histogram.h
+++ b/include/grpc/support/histogram.h
@@ -34,6 +34,9 @@
#ifndef GRPC_SUPPORT_HISTOGRAM_H
#define GRPC_SUPPORT_HISTOGRAM_H
+#include <grpc/support/port_platform.h>
+#include <stddef.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -59,6 +62,13 @@ double gpr_histogram_count(gpr_histogram *histogram);
double gpr_histogram_sum(gpr_histogram *histogram);
double gpr_histogram_sum_of_squares(gpr_histogram *histogram);
+const gpr_uint32 *gpr_histogram_get_contents(gpr_histogram *histogram,
+ size_t *count);
+void gpr_histogram_merge_contents(gpr_histogram *histogram,
+ const gpr_uint32 *data, size_t data_count,
+ double min_seen, double max_seen, double sum,
+ double sum_of_squares, double count);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/compiler/python_plugin.cc b/src/compiler/python_plugin.cc
index 0dd2c5b834..825f15a5c7 100644
--- a/src/compiler/python_plugin.cc
+++ b/src/compiler/python_plugin.cc
@@ -36,6 +36,7 @@
#include <cstring>
#include <memory>
#include <string>
+#include <tuple>
#include "src/compiler/python_generator.h"
#include <google/protobuf/compiler/code_generator.h>
diff --git a/src/core/iomgr/resolve_address_posix.c b/src/core/iomgr/resolve_address_posix.c
index 989b968ae2..85085dc37d 100644
--- a/src/core/iomgr/resolve_address_posix.c
+++ b/src/core/iomgr/resolve_address_posix.c
@@ -102,6 +102,21 @@ grpc_resolved_addresses *grpc_blocking_resolve_address(
s = getaddrinfo(host, port, &hints, &result);
if (s != 0) {
+ /* Retry if well-known service name is recognized */
+ char *svc[][2] = {
+ {"http", "80"},
+ {"https", "443"}
+ };
+ int i;
+ for (i = 0; i < (int)(sizeof(svc) / sizeof(svc[0])); i++) {
+ if (!strcmp(port, svc[i][0])) {
+ s = getaddrinfo(host, svc[i][1], &hints, &result);
+ break;
+ }
+ }
+ }
+
+ if (s != 0) {
gpr_log(GPR_ERROR, "getaddrinfo: %s", gai_strerror(s));
goto done;
}
diff --git a/src/core/support/histogram.c b/src/core/support/histogram.c
index eacb77082f..ed344b43e8 100644
--- a/src/core/support/histogram.c
+++ b/src/core/support/histogram.c
@@ -126,25 +126,35 @@ void gpr_histogram_add(gpr_histogram *h, double x) {
}
int gpr_histogram_merge(gpr_histogram *dst, gpr_histogram *src) {
- size_t i;
if ((dst->num_buckets != src->num_buckets) ||
(dst->multiplier != src->multiplier)) {
/* Fail because these histograms don't match */
return 0;
}
- dst->sum += src->sum;
- dst->sum_of_squares += src->sum_of_squares;
- dst->count += src->count;
- if (src->min_seen < dst->min_seen) {
- dst->min_seen = src->min_seen;
+ gpr_histogram_merge_contents(dst, src->buckets, src->num_buckets,
+ src->min_seen, src->max_seen, src->sum,
+ src->sum_of_squares, src->count);
+ return 1;
+}
+
+void gpr_histogram_merge_contents(gpr_histogram *dst, const gpr_uint32 *data,
+ size_t data_count, double min_seen,
+ double max_seen, double sum,
+ double sum_of_squares, double count) {
+ size_t i;
+ GPR_ASSERT(dst->num_buckets == data_count);
+ dst->sum += sum;
+ dst->sum_of_squares += sum_of_squares;
+ dst->count += count;
+ if (min_seen < dst->min_seen) {
+ dst->min_seen = min_seen;
}
- if (src->max_seen > dst->max_seen) {
- dst->max_seen = src->max_seen;
+ if (max_seen > dst->max_seen) {
+ dst->max_seen = max_seen;
}
for (i = 0; i < dst->num_buckets; i++) {
- dst->buckets[i] += src->buckets[i];
+ dst->buckets[i] += data[i];
}
- return 1;
}
static double threshold_for_count_below(gpr_histogram *h, double count_below) {
@@ -222,3 +232,8 @@ double gpr_histogram_sum(gpr_histogram *h) { return h->sum; }
double gpr_histogram_sum_of_squares(gpr_histogram *h) {
return h->sum_of_squares;
}
+
+const gpr_uint32 *gpr_histogram_get_contents(gpr_histogram *h, size_t *size) {
+ *size = h->num_buckets;
+ return h->buckets;
+}
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index b2033f3dc0..cfce943794 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -375,6 +375,7 @@ static void unlock(grpc_call *call) {
sizeof(completed_requests));
call->num_completed_requests = 0;
call->completing = 1;
+ grpc_call_internal_ref(call);
}
if (!call->sending) {
@@ -403,6 +404,7 @@ static void unlock(grpc_call *call) {
lock(call);
call->completing = 0;
unlock(call);
+ grpc_call_internal_unref(call, 0);
}
}
diff --git a/src/node/binding.gyp b/src/node/binding.gyp
index 10afaf6962..7ef3bdf4bd 100644
--- a/src/node/binding.gyp
+++ b/src/node/binding.gyp
@@ -1,9 +1,4 @@
{
- "variables" : {
- 'no_install': "<!(echo $GRPC_NO_INSTALL)",
- 'grpc_root': "<!(echo $GRPC_ROOT)",
- 'grpc_lib_subdir': "<!(echo $GRPC_LIB_SUBDIR)"
- },
"targets" : [
{
'include_dirs': [
@@ -24,7 +19,9 @@
'link_settings': {
'libraries': [
'-lrt',
- '-lpthread'
+ '-lpthread',
+ '-lgrpc',
+ '-lgpr'
],
},
"target_name": "grpc",
@@ -38,27 +35,6 @@
"ext/server.cc",
"ext/server_credentials.cc",
"ext/timeval.cc"
- ],
- 'conditions' : [
- ['no_install=="yes"', {
- 'include_dirs': [
- "<(grpc_root)/include"
- ],
- 'link_settings': {
- 'libraries': [
- '<(grpc_root)/<(grpc_lib_subdir)/libgrpc.a',
- '<(grpc_root)/<(grpc_lib_subdir)/libgpr.a'
- ]
- }
- }],
- ['no_install!="yes"', {
- 'link_settings': {
- 'libraries': [
- '-lgrpc',
- '-lgpr'
- ]
- }
- }]
]
}
]
diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc
index c165d26e47..5235c8e083 100644
--- a/src/node/ext/byte_buffer.cc
+++ b/src/node/ext/byte_buffer.cc
@@ -44,7 +44,6 @@
namespace grpc {
namespace node {
-using ::node::Buffer;
using v8::Context;
using v8::Function;
using v8::Handle;
@@ -54,8 +53,8 @@ using v8::Value;
grpc_byte_buffer *BufferToByteBuffer(Handle<Value> buffer) {
NanScope();
- int length = Buffer::Length(buffer);
- char *data = Buffer::Data(buffer);
+ int length = ::node::Buffer::Length(buffer);
+ char *data = ::node::Buffer::Data(buffer);
gpr_slice slice = gpr_slice_malloc(length);
memcpy(GPR_SLICE_START_PTR(slice), data, length);
grpc_byte_buffer *byte_buffer(grpc_byte_buffer_create(&slice, 1));
@@ -66,7 +65,7 @@ grpc_byte_buffer *BufferToByteBuffer(Handle<Value> buffer) {
Handle<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) {
NanEscapableScope();
if (buffer == NULL) {
- NanReturnNull();
+ return NanNull();
}
size_t length = grpc_byte_buffer_length(buffer);
char *result = reinterpret_cast<char *>(calloc(length, sizeof(char)));
@@ -82,12 +81,14 @@ Handle<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) {
Handle<Value> MakeFastBuffer(Handle<Value> slowBuffer) {
NanEscapableScope();
- Handle<Object> globalObj = Context::GetCurrent()->Global();
+ Handle<Object> globalObj = NanGetCurrentContext()->Global();
Handle<Function> bufferConstructor = Handle<Function>::Cast(
globalObj->Get(NanNew("Buffer")));
- Handle<Value> consArgs[3] = { slowBuffer,
- NanNew<Number>(Buffer::Length(slowBuffer)),
- NanNew<Number>(0) };
+ Handle<Value> consArgs[3] = {
+ slowBuffer,
+ NanNew<Number>(::node::Buffer::Length(slowBuffer)),
+ NanNew<Number>(0)
+ };
Handle<Object> fastBuffer = bufferConstructor->NewInstance(3, consArgs);
return NanEscapeScope(fastBuffer);
}
diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc
index 9ed389f3bc..afb6541783 100644
--- a/src/node/ext/call.cc
+++ b/src/node/ext/call.cc
@@ -54,8 +54,6 @@ using std::vector;
namespace grpc {
namespace node {
-using ::node::Buffer;
-using v8::Arguments;
using v8::Array;
using v8::Boolean;
using v8::Exception;
@@ -74,7 +72,7 @@ using v8::Uint32;
using v8::String;
using v8::Value;
-Persistent<Function> Call::constructor;
+NanCallback *Call::constructor;
Persistent<FunctionTemplate> Call::fun_tpl;
@@ -101,11 +99,11 @@ bool CreateMetadataArray(Handle<Object> metadata, grpc_metadata_array *array,
Handle<Value> value = values->Get(j);
grpc_metadata *current = &array->metadata[array->count];
current->key = **utf8_key;
- if (Buffer::HasInstance(value)) {
- current->value = Buffer::Data(value);
- current->value_length = Buffer::Length(value);
- Persistent<Value> handle;
- NanAssignPersistent(handle, value);
+ if (::node::Buffer::HasInstance(value)) {
+ current->value = ::node::Buffer::Data(value);
+ current->value_length = ::node::Buffer::Length(value);
+ Persistent<Value> *handle = new Persistent<Value>();
+ NanAssignPersistent(*handle, value);
resources->handles.push_back(unique_ptr<PersistentHolder>(
new PersistentHolder(handle)));
} else if (value->IsString()) {
@@ -140,7 +138,7 @@ Handle<Value> ParseMetadata(const grpc_metadata_array *metadata_array) {
Handle<Object> metadata_object = NanNew<Object>();
for (unsigned int i = 0; i < length; i++) {
grpc_metadata* elem = &metadata_elements[i];
- Handle<String> key_string = String::New(elem->key);
+ Handle<String> key_string = NanNew(elem->key);
Handle<Array> array;
if (metadata_object->Has(key_string)) {
array = Handle<Array>::Cast(metadata_object->Get(key_string));
@@ -194,12 +192,12 @@ class SendMessageOp : public Op {
}
bool ParseOp(Handle<Value> value, grpc_op *out,
shared_ptr<Resources> resources) {
- if (!Buffer::HasInstance(value)) {
+ if (!::node::Buffer::HasInstance(value)) {
return false;
}
out->data.send_message = BufferToByteBuffer(value);
- Persistent<Value> handle;
- NanAssignPersistent(handle, value);
+ Persistent<Value> *handle = new Persistent<Value>();
+ NanAssignPersistent(*handle, value);
resources->handles.push_back(unique_ptr<PersistentHolder>(
new PersistentHolder(handle)));
return true;
@@ -357,7 +355,7 @@ class ClientStatusOp : public Op {
Handle<Object> status_obj = NanNew<Object>();
status_obj->Set(NanNew("code"), NanNew<Number>(status));
if (status_details != NULL) {
- status_obj->Set(NanNew("details"), String::New(status_details));
+ status_obj->Set(NanNew("details"), NanNew(status_details));
}
status_obj->Set(NanNew("metadata"), ParseMetadata(&metadata_array));
return NanEscapeScope(status_obj);
@@ -436,20 +434,21 @@ Call::~Call() {
void Call::Init(Handle<Object> exports) {
NanScope();
- Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
+ Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew("Call"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanSetPrototypeTemplate(tpl, "startBatch",
- FunctionTemplate::New(StartBatch)->GetFunction());
+ NanNew<FunctionTemplate>(StartBatch)->GetFunction());
NanSetPrototypeTemplate(tpl, "cancel",
- FunctionTemplate::New(Cancel)->GetFunction());
+ NanNew<FunctionTemplate>(Cancel)->GetFunction());
NanAssignPersistent(fun_tpl, tpl);
- NanAssignPersistent(constructor, tpl->GetFunction());
- constructor->Set(NanNew("WRITE_BUFFER_HINT"),
- NanNew<Uint32, uint32_t>(GRPC_WRITE_BUFFER_HINT));
- constructor->Set(NanNew("WRITE_NO_COMPRESS"),
- NanNew<Uint32, uint32_t>(GRPC_WRITE_NO_COMPRESS));
- exports->Set(String::NewSymbol("Call"), constructor);
+ Handle<Function> ctr = tpl->GetFunction();
+ ctr->Set(NanNew("WRITE_BUFFER_HINT"),
+ NanNew<Uint32, uint32_t>(GRPC_WRITE_BUFFER_HINT));
+ ctr->Set(NanNew("WRITE_NO_COMPRESS"),
+ NanNew<Uint32, uint32_t>(GRPC_WRITE_NO_COMPRESS));
+ exports->Set(NanNew("Call"), ctr);
+ constructor = new NanCallback(ctr);
}
bool Call::HasInstance(Handle<Value> val) {
@@ -463,8 +462,8 @@ Handle<Value> Call::WrapStruct(grpc_call *call) {
return NanEscapeScope(NanNull());
}
const int argc = 1;
- Handle<Value> argv[argc] = {External::New(reinterpret_cast<void *>(call))};
- return NanEscapeScope(constructor->NewInstance(argc, argv));
+ Handle<Value> argv[argc] = {NanNew<External>(reinterpret_cast<void *>(call))};
+ return NanEscapeScope(constructor->GetFunction()->NewInstance(argc, argv));
}
NAN_METHOD(Call::New) {
@@ -473,9 +472,10 @@ NAN_METHOD(Call::New) {
if (args.IsConstructCall()) {
Call *call;
if (args[0]->IsExternal()) {
+ Handle<External> ext = args[0].As<External>();
// This option is used for wrapping an existing call
grpc_call *call_value =
- reinterpret_cast<grpc_call *>(External::Unwrap(args[0]));
+ reinterpret_cast<grpc_call *>(ext->Value());
call = new Call(call_value);
} else {
if (!Channel::HasInstance(args[0])) {
@@ -500,15 +500,14 @@ NAN_METHOD(Call::New) {
wrapped_channel, CompletionQueueAsyncWorker::GetQueue(), *method,
channel->GetHost(), MillisecondsToTimespec(deadline));
call = new Call(wrapped_call);
- args.This()->SetHiddenValue(String::NewSymbol("channel_"),
- channel_object);
+ args.This()->SetHiddenValue(NanNew("channel_"), channel_object);
}
call->Wrap(args.This());
NanReturnValue(args.This());
} else {
const int argc = 4;
Local<Value> argv[argc] = {args[0], args[1], args[2], args[3]};
- NanReturnValue(constructor->NewInstance(argc, argv));
+ NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
}
}
diff --git a/src/node/ext/call.h b/src/node/ext/call.h
index 933541ce5b..43142c7091 100644
--- a/src/node/ext/call.h
+++ b/src/node/ext/call.h
@@ -40,6 +40,7 @@
#include <node.h>
#include <nan.h>
#include "grpc/grpc.h"
+#include "grpc/support/log.h"
#include "channel.h"
@@ -54,16 +55,17 @@ v8::Handle<v8::Value> ParseMetadata(const grpc_metadata_array *metadata_array);
class PersistentHolder {
public:
- explicit PersistentHolder(v8::Persistent<v8::Value> persist) :
+ explicit PersistentHolder(v8::Persistent<v8::Value> *persist) :
persist(persist) {
}
~PersistentHolder() {
- NanDisposePersistent(persist);
+ NanDisposePersistent(*persist);
+ delete persist;
}
private:
- v8::Persistent<v8::Value> persist;
+ v8::Persistent<v8::Value> *persist;
};
struct Resources {
@@ -118,7 +120,7 @@ class Call : public ::node::ObjectWrap {
static NAN_METHOD(New);
static NAN_METHOD(StartBatch);
static NAN_METHOD(Cancel);
- static v8::Persistent<v8::Function> constructor;
+ static NanCallback *constructor;
// Used for typechecking instances of this javascript class
static v8::Persistent<v8::FunctionTemplate> fun_tpl;
diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc
index bc9461d7df..787e274973 100644
--- a/src/node/ext/channel.cc
+++ b/src/node/ext/channel.cc
@@ -45,7 +45,6 @@
namespace grpc {
namespace node {
-using v8::Arguments;
using v8::Array;
using v8::Exception;
using v8::Function;
@@ -59,7 +58,7 @@ using v8::Persistent;
using v8::String;
using v8::Value;
-Persistent<Function> Channel::constructor;
+NanCallback *Channel::constructor;
Persistent<FunctionTemplate> Channel::fun_tpl;
Channel::Channel(grpc_channel *channel, NanUtf8String *host)
@@ -74,14 +73,15 @@ Channel::~Channel() {
void Channel::Init(Handle<Object> exports) {
NanScope();
- Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
+ Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew("Channel"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanSetPrototypeTemplate(tpl, "close",
- FunctionTemplate::New(Close)->GetFunction());
+ NanNew<FunctionTemplate>(Close)->GetFunction());
NanAssignPersistent(fun_tpl, tpl);
- NanAssignPersistent(constructor, tpl->GetFunction());
- exports->Set(NanNew("Channel"), constructor);
+ Handle<Function> ctr = tpl->GetFunction();
+ constructor = new NanCallback(ctr);
+ exports->Set(NanNew("Channel"), ctr);
}
bool Channel::HasInstance(Handle<Value> val) {
@@ -170,7 +170,7 @@ NAN_METHOD(Channel::New) {
} else {
const int argc = 2;
Local<Value> argv[argc] = {args[0], args[1]};
- NanReturnValue(constructor->NewInstance(argc, argv));
+ NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
}
}
diff --git a/src/node/ext/channel.h b/src/node/ext/channel.h
index bf793194d9..b3aa0f700f 100644
--- a/src/node/ext/channel.h
+++ b/src/node/ext/channel.h
@@ -66,7 +66,7 @@ class Channel : public ::node::ObjectWrap {
static NAN_METHOD(New);
static NAN_METHOD(Close);
- static v8::Persistent<v8::Function> constructor;
+ static NanCallback *constructor;
static v8::Persistent<v8::FunctionTemplate> fun_tpl;
grpc_channel *wrapped_channel;
diff --git a/src/node/ext/credentials.cc b/src/node/ext/credentials.cc
index 3f65d59c76..34872017ea 100644
--- a/src/node/ext/credentials.cc
+++ b/src/node/ext/credentials.cc
@@ -41,8 +41,6 @@
namespace grpc {
namespace node {
-using ::node::Buffer;
-using v8::Arguments;
using v8::Exception;
using v8::External;
using v8::Function;
@@ -56,7 +54,7 @@ using v8::ObjectTemplate;
using v8::Persistent;
using v8::Value;
-Persistent<Function> Credentials::constructor;
+NanCallback *Credentials::constructor;
Persistent<FunctionTemplate> Credentials::fun_tpl;
Credentials::Credentials(grpc_credentials *credentials)
@@ -68,24 +66,25 @@ Credentials::~Credentials() {
void Credentials::Init(Handle<Object> exports) {
NanScope();
- Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
+ Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew("Credentials"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanAssignPersistent(fun_tpl, tpl);
- NanAssignPersistent(constructor, tpl->GetFunction());
- constructor->Set(NanNew("createDefault"),
- FunctionTemplate::New(CreateDefault)->GetFunction());
- constructor->Set(NanNew("createSsl"),
- FunctionTemplate::New(CreateSsl)->GetFunction());
- constructor->Set(NanNew("createComposite"),
- FunctionTemplate::New(CreateComposite)->GetFunction());
- constructor->Set(NanNew("createGce"),
- FunctionTemplate::New(CreateGce)->GetFunction());
- constructor->Set(NanNew("createFake"),
- FunctionTemplate::New(CreateFake)->GetFunction());
- constructor->Set(NanNew("createIam"),
- FunctionTemplate::New(CreateIam)->GetFunction());
- exports->Set(NanNew("Credentials"), constructor);
+ Handle<Function> ctr = tpl->GetFunction();
+ ctr->Set(NanNew("createDefault"),
+ NanNew<FunctionTemplate>(CreateDefault)->GetFunction());
+ ctr->Set(NanNew("createSsl"),
+ NanNew<FunctionTemplate>(CreateSsl)->GetFunction());
+ ctr->Set(NanNew("createComposite"),
+ NanNew<FunctionTemplate>(CreateComposite)->GetFunction());
+ ctr->Set(NanNew("createGce"),
+ NanNew<FunctionTemplate>(CreateGce)->GetFunction());
+ ctr->Set(NanNew("createFake"),
+ NanNew<FunctionTemplate>(CreateFake)->GetFunction());
+ ctr->Set(NanNew("createIam"),
+ NanNew<FunctionTemplate>(CreateIam)->GetFunction());
+ constructor = new NanCallback(ctr);
+ exports->Set(NanNew("Credentials"), ctr);
}
bool Credentials::HasInstance(Handle<Value> val) {
@@ -100,8 +99,8 @@ Handle<Value> Credentials::WrapStruct(grpc_credentials *credentials) {
}
const int argc = 1;
Handle<Value> argv[argc] = {
- External::New(reinterpret_cast<void *>(credentials))};
- return NanEscapeScope(constructor->NewInstance(argc, argv));
+ NanNew<External>(reinterpret_cast<void *>(credentials))};
+ return NanEscapeScope(constructor->GetFunction()->NewInstance(argc, argv));
}
grpc_credentials *Credentials::GetWrappedCredentials() {
@@ -116,15 +115,16 @@ NAN_METHOD(Credentials::New) {
return NanThrowTypeError(
"Credentials can only be created with the provided functions");
}
+ Handle<External> ext = args[0].As<External>();
grpc_credentials *creds_value =
- reinterpret_cast<grpc_credentials *>(External::Unwrap(args[0]));
+ reinterpret_cast<grpc_credentials *>(ext->Value());
Credentials *credentials = new Credentials(creds_value);
credentials->Wrap(args.This());
NanReturnValue(args.This());
} else {
const int argc = 1;
Local<Value> argv[argc] = {args[0]};
- NanReturnValue(constructor->NewInstance(argc, argv));
+ NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
}
}
@@ -137,19 +137,19 @@ NAN_METHOD(Credentials::CreateSsl) {
NanScope();
char *root_certs = NULL;
grpc_ssl_pem_key_cert_pair key_cert_pair = {NULL, NULL};
- if (Buffer::HasInstance(args[0])) {
- root_certs = Buffer::Data(args[0]);
+ if (::node::Buffer::HasInstance(args[0])) {
+ root_certs = ::node::Buffer::Data(args[0]);
} else if (!(args[0]->IsNull() || args[0]->IsUndefined())) {
return NanThrowTypeError("createSsl's first argument must be a Buffer");
}
- if (Buffer::HasInstance(args[1])) {
- key_cert_pair.private_key = Buffer::Data(args[1]);
+ if (::node::Buffer::HasInstance(args[1])) {
+ key_cert_pair.private_key = ::node::Buffer::Data(args[1]);
} else if (!(args[1]->IsNull() || args[1]->IsUndefined())) {
return NanThrowTypeError(
"createSSl's second argument must be a Buffer if provided");
}
- if (Buffer::HasInstance(args[2])) {
- key_cert_pair.cert_chain = Buffer::Data(args[2]);
+ if (::node::Buffer::HasInstance(args[2])) {
+ key_cert_pair.cert_chain = ::node::Buffer::Data(args[2]);
} else if (!(args[2]->IsNull() || args[2]->IsUndefined())) {
return NanThrowTypeError(
"createSSl's third argument must be a Buffer if provided");
diff --git a/src/node/ext/credentials.h b/src/node/ext/credentials.h
index e60be3d4e1..794736fe1a 100644
--- a/src/node/ext/credentials.h
+++ b/src/node/ext/credentials.h
@@ -68,7 +68,7 @@ class Credentials : public ::node::ObjectWrap {
static NAN_METHOD(CreateGce);
static NAN_METHOD(CreateFake);
static NAN_METHOD(CreateIam);
- static v8::Persistent<v8::Function> constructor;
+ static NanCallback *constructor;
// Used for typechecking instances of this javascript class
static v8::Persistent<v8::FunctionTemplate> fun_tpl;
diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc
index 9f5095839c..4e31cbaa27 100644
--- a/src/node/ext/node_grpc.cc
+++ b/src/node/ext/node_grpc.cc
@@ -51,7 +51,7 @@ using v8::String;
void InitStatusConstants(Handle<Object> exports) {
NanScope();
- Handle<Object> status = Object::New();
+ Handle<Object> status = NanNew<Object>();
exports->Set(NanNew("status"), status);
Handle<Value> OK(NanNew<Uint32, uint32_t>(GRPC_STATUS_OK));
status->Set(NanNew("OK"), OK);
@@ -100,7 +100,7 @@ void InitStatusConstants(Handle<Object> exports) {
void InitCallErrorConstants(Handle<Object> exports) {
NanScope();
- Handle<Object> call_error = Object::New();
+ Handle<Object> call_error = NanNew<Object>();
exports->Set(NanNew("callError"), call_error);
Handle<Value> OK(NanNew<Uint32, uint32_t>(GRPC_CALL_OK));
call_error->Set(NanNew("OK"), OK);
@@ -131,7 +131,7 @@ void InitCallErrorConstants(Handle<Object> exports) {
void InitOpTypeConstants(Handle<Object> exports) {
NanScope();
- Handle<Object> op_type = Object::New();
+ Handle<Object> op_type = NanNew<Object>();
exports->Set(NanNew("opType"), op_type);
Handle<Value> SEND_INITIAL_METADATA(
NanNew<Uint32, uint32_t>(GRPC_OP_SEND_INITIAL_METADATA));
diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc
index a87f9194e9..e47bac833b 100644
--- a/src/node/ext/server.cc
+++ b/src/node/ext/server.cc
@@ -53,7 +53,6 @@ namespace grpc {
namespace node {
using std::unique_ptr;
-using v8::Arguments;
using v8::Array;
using v8::Boolean;
using v8::Date;
@@ -69,7 +68,7 @@ using v8::Persistent;
using v8::String;
using v8::Value;
-Persistent<Function> Server::constructor;
+NanCallback *Server::constructor;
Persistent<FunctionTemplate> Server::fun_tpl;
class NewCallOp : public Op {
@@ -121,28 +120,30 @@ Server::~Server() { grpc_server_destroy(wrapped_server); }
void Server::Init(Handle<Object> exports) {
NanScope();
- Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
- tpl->SetClassName(String::NewSymbol("Server"));
+ Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
+ tpl->SetClassName(NanNew("Server"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanSetPrototypeTemplate(tpl, "requestCall",
- FunctionTemplate::New(RequestCall)->GetFunction());
+ NanNew<FunctionTemplate>(RequestCall)->GetFunction());
- NanSetPrototypeTemplate(tpl, "addHttp2Port",
- FunctionTemplate::New(AddHttp2Port)->GetFunction());
+ NanSetPrototypeTemplate(
+ tpl, "addHttp2Port",
+ NanNew<FunctionTemplate>(AddHttp2Port)->GetFunction());
NanSetPrototypeTemplate(
tpl, "addSecureHttp2Port",
- FunctionTemplate::New(AddSecureHttp2Port)->GetFunction());
+ NanNew<FunctionTemplate>(AddSecureHttp2Port)->GetFunction());
NanSetPrototypeTemplate(tpl, "start",
- FunctionTemplate::New(Start)->GetFunction());
+ NanNew<FunctionTemplate>(Start)->GetFunction());
NanSetPrototypeTemplate(tpl, "shutdown",
- FunctionTemplate::New(Shutdown)->GetFunction());
+ NanNew<FunctionTemplate>(Shutdown)->GetFunction());
NanAssignPersistent(fun_tpl, tpl);
- NanAssignPersistent(constructor, tpl->GetFunction());
- exports->Set(String::NewSymbol("Server"), constructor);
+ Handle<Function> ctr = tpl->GetFunction();
+ constructor = new NanCallback(ctr);
+ exports->Set(NanNew("Server"), ctr);
}
bool Server::HasInstance(Handle<Value> val) {
@@ -157,7 +158,7 @@ NAN_METHOD(Server::New) {
if (!args.IsConstructCall()) {
const int argc = 1;
Local<Value> argv[argc] = {args[0]};
- NanReturnValue(constructor->NewInstance(argc, argv));
+ NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
}
grpc_server *wrapped_server;
grpc_completion_queue *queue = CompletionQueueAsyncWorker::GetQueue();
diff --git a/src/node/ext/server.h b/src/node/ext/server.h
index 2056fe7d3f..641d5ccb3e 100644
--- a/src/node/ext/server.h
+++ b/src/node/ext/server.h
@@ -67,7 +67,7 @@ class Server : public ::node::ObjectWrap {
static NAN_METHOD(AddSecureHttp2Port);
static NAN_METHOD(Start);
static NAN_METHOD(Shutdown);
- static v8::Persistent<v8::Function> constructor;
+ static NanCallback *constructor;
static v8::Persistent<v8::FunctionTemplate> fun_tpl;
grpc_server *wrapped_server;
diff --git a/src/node/ext/server_credentials.cc b/src/node/ext/server_credentials.cc
index f75a2bf79c..d2b63cdc4e 100644
--- a/src/node/ext/server_credentials.cc
+++ b/src/node/ext/server_credentials.cc
@@ -41,8 +41,6 @@
namespace grpc {
namespace node {
-using ::node::Buffer;
-using v8::Arguments;
using v8::Exception;
using v8::External;
using v8::Function;
@@ -56,7 +54,7 @@ using v8::ObjectTemplate;
using v8::Persistent;
using v8::Value;
-Persistent<Function> ServerCredentials::constructor;
+NanCallback *ServerCredentials::constructor;
Persistent<FunctionTemplate> ServerCredentials::fun_tpl;
ServerCredentials::ServerCredentials(grpc_server_credentials *credentials)
@@ -68,16 +66,17 @@ ServerCredentials::~ServerCredentials() {
void ServerCredentials::Init(Handle<Object> exports) {
NanScope();
- Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
+ Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew("ServerCredentials"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanAssignPersistent(fun_tpl, tpl);
- NanAssignPersistent(constructor, tpl->GetFunction());
- constructor->Set(NanNew("createSsl"),
- FunctionTemplate::New(CreateSsl)->GetFunction());
- constructor->Set(NanNew("createFake"),
- FunctionTemplate::New(CreateFake)->GetFunction());
- exports->Set(NanNew("ServerCredentials"), constructor);
+ Handle<Function> ctr = tpl->GetFunction();
+ ctr->Set(NanNew("createSsl"),
+ NanNew<FunctionTemplate>(CreateSsl)->GetFunction());
+ ctr->Set(NanNew("createFake"),
+ NanNew<FunctionTemplate>(CreateFake)->GetFunction());
+ constructor = new NanCallback(ctr);
+ exports->Set(NanNew("ServerCredentials"), ctr);
}
bool ServerCredentials::HasInstance(Handle<Value> val) {
@@ -93,8 +92,8 @@ Handle<Value> ServerCredentials::WrapStruct(
}
const int argc = 1;
Handle<Value> argv[argc] = {
- External::New(reinterpret_cast<void *>(credentials))};
- return NanEscapeScope(constructor->NewInstance(argc, argv));
+ NanNew<External>(reinterpret_cast<void *>(credentials))};
+ return NanEscapeScope(constructor->GetFunction()->NewInstance(argc, argv));
}
grpc_server_credentials *ServerCredentials::GetWrappedServerCredentials() {
@@ -109,15 +108,16 @@ NAN_METHOD(ServerCredentials::New) {
return NanThrowTypeError(
"ServerCredentials can only be created with the provide functions");
}
+ Handle<External> ext = args[0].As<External>();
grpc_server_credentials *creds_value =
- reinterpret_cast<grpc_server_credentials *>(External::Unwrap(args[0]));
+ reinterpret_cast<grpc_server_credentials *>(ext->Value());
ServerCredentials *credentials = new ServerCredentials(creds_value);
credentials->Wrap(args.This());
NanReturnValue(args.This());
} else {
const int argc = 1;
Local<Value> argv[argc] = {args[0]};
- NanReturnValue(constructor->NewInstance(argc, argv));
+ NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
}
}
@@ -126,20 +126,20 @@ NAN_METHOD(ServerCredentials::CreateSsl) {
NanScope();
char *root_certs = NULL;
grpc_ssl_pem_key_cert_pair key_cert_pair;
- if (Buffer::HasInstance(args[0])) {
- root_certs = Buffer::Data(args[0]);
+ if (::node::Buffer::HasInstance(args[0])) {
+ root_certs = ::node::Buffer::Data(args[0]);
} else if (!(args[0]->IsNull() || args[0]->IsUndefined())) {
return NanThrowTypeError(
"createSSl's first argument must be a Buffer if provided");
}
- if (!Buffer::HasInstance(args[1])) {
+ if (!::node::Buffer::HasInstance(args[1])) {
return NanThrowTypeError("createSsl's second argument must be a Buffer");
}
- key_cert_pair.private_key = Buffer::Data(args[1]);
- if (!Buffer::HasInstance(args[2])) {
+ key_cert_pair.private_key = ::node::Buffer::Data(args[1]);
+ if (!::node::Buffer::HasInstance(args[2])) {
return NanThrowTypeError("createSsl's third argument must be a Buffer");
}
- key_cert_pair.cert_chain = Buffer::Data(args[2]);
+ key_cert_pair.cert_chain = ::node::Buffer::Data(args[2]);
NanReturnValue(WrapStruct(
grpc_ssl_server_credentials_create(root_certs, &key_cert_pair, 1)));
}
diff --git a/src/node/ext/server_credentials.h b/src/node/ext/server_credentials.h
index f09902420c..aaa7ef297a 100644
--- a/src/node/ext/server_credentials.h
+++ b/src/node/ext/server_credentials.h
@@ -64,7 +64,7 @@ class ServerCredentials : public ::node::ObjectWrap {
static NAN_METHOD(New);
static NAN_METHOD(CreateSsl);
static NAN_METHOD(CreateFake);
- static v8::Persistent<v8::Function> constructor;
+ static NanCallback *constructor;
// Used for typechecking instances of this javascript class
static v8::Persistent<v8::FunctionTemplate> fun_tpl;
diff --git a/src/node/package.json b/src/node/package.json
index 0ef1c990b1..20eb21fc47 100644
--- a/src/node/package.json
+++ b/src/node/package.json
@@ -1,6 +1,6 @@
{
"name": "grpc",
- "version": "0.5.1",
+ "version": "0.5.2",
"author": "Google Inc.",
"description": "gRPC Library for Node",
"homepage": "http://www.grpc.io/",
@@ -24,20 +24,23 @@
"test": "node ./node_modules/mocha/bin/mocha && npm run-script lint"
},
"dependencies": {
- "bindings": "^1.2.1",
- "jshint": "^2.5.5",
- "nan": "~1.3.0",
+ "bindings": "^1.2.0",
+ "nan": "^1.5.0",
"protobufjs": "murgatroid99/ProtoBuf.js",
- "underscore": "^1.7.0",
+ "underscore": "^1.6.0",
"underscore.string": "^3.0.0"
},
"devDependencies": {
"async": "^0.9.0",
"google-auth-library": "^0.9.2",
+ "jshint": "^2.5.0",
"minimist": "^1.1.0",
"mocha": "~1.21.0",
"strftime": "^0.8.2"
},
+ "engines": {
+ "node": ">=0.10.13"
+ },
"files": [
"LICENSE",
"README.md",
diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb
index 483a31f60c..f15f85bf56 100644
--- a/src/ruby/ext/grpc/extconf.rb
+++ b/src/ruby/ext/grpc/extconf.rb
@@ -77,7 +77,6 @@ end
dir_config('grpc', HEADER_DIRS, LIB_DIRS)
-$CFLAGS << ' -std=c89 '
$CFLAGS << ' -Wno-implicit-function-declaration '
$CFLAGS << ' -Wno-pointer-sign '
$CFLAGS << ' -Wno-return-type '
diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c
index c7671c8a77..400efd0dfa 100644
--- a/src/ruby/ext/grpc/rb_grpc.c
+++ b/src/ruby/ext/grpc/rb_grpc.c
@@ -119,12 +119,12 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) {
break;
case T_FLOAT:
- if (interval && RFLOAT(time)->float_value < 0.0)
+ if (interval && RFLOAT_VALUE(time) < 0.0)
rb_raise(rb_eArgError, "%s must be positive", tstr);
else {
double f, d;
- d = modf(RFLOAT(time)->float_value, &f);
+ d = modf(RFLOAT_VALUE(time), &f);
if (d < 0) {
d += 1;
f -= 1;
@@ -132,7 +132,7 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) {
t.tv_sec = (time_t)f;
if (f != t.tv_sec) {
rb_raise(rb_eRangeError, "%f out of Time range",
- RFLOAT(time)->float_value);
+ RFLOAT_VALUE(time));
}
t.tv_nsec = (time_t)(d * 1e9 + 0.5);
}
diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.c
index f0a3e26c4e..a084c55a35 100644
--- a/test/core/network_benchmarks/low_level_ping_pong.c
+++ b/test/core/network_benchmarks/low_level_ping_pong.c
@@ -81,7 +81,7 @@ typedef struct thread_args {
/* Basic call to read() */
static int read_bytes(int fd, char *buf, size_t read_size, int spin) {
- int bytes_read = 0;
+ size_t bytes_read = 0;
int err;
do {
err = read(fd, buf + bytes_read, read_size - bytes_read);
@@ -198,7 +198,7 @@ static int epoll_read_bytes_spin(struct thread_args *args, char *buf) {
writes go directly out to the kernel.
*/
static int blocking_write_bytes(struct thread_args *args, char *buf) {
- int bytes_written = 0;
+ size_t bytes_written = 0;
int err;
size_t write_size = args->msg_size;
do {
@@ -586,10 +586,10 @@ static int run_benchmark(char *socket_type, thread_args *client_args,
static int run_all_benchmarks(int msg_size) {
int error = 0;
- int i;
+ size_t i;
for (i = 0; i < GPR_ARRAY_SIZE(test_strategies); ++i) {
test_strategy *test_strategy = &test_strategies[i];
- int j;
+ size_t j;
for (j = 0; j < GPR_ARRAY_SIZE(socket_types); ++j) {
thread_args *client_args = malloc(sizeof(thread_args));
thread_args *server_args = malloc(sizeof(thread_args));
@@ -620,7 +620,7 @@ int main(int argc, char **argv) {
int msg_size = -1;
char *read_strategy = NULL;
char *socket_type = NULL;
- int i;
+ size_t i;
const test_strategy *test_strategy = NULL;
int error = 0;
diff --git a/test/core/util/grpc_profiler.c b/test/core/util/grpc_profiler.c
index 35b9361c70..d5b6cfeef1 100644
--- a/test/core/util/grpc_profiler.c
+++ b/test/core/util/grpc_profiler.c
@@ -44,7 +44,7 @@ void grpc_profiler_stop() { ProfilerStop(); }
void grpc_profiler_start(const char *filename) {
gpr_log(GPR_DEBUG,
- "You do not have google-perftools installed, profiling is disabled");
+ "You do not have google-perftools installed, profiling is disabled [for %s]", filename);
gpr_log(GPR_DEBUG,
"To install on ubuntu: sudo apt-get install google-perftools "
"libgoogle-perftools-dev");
diff --git a/test/cpp/qps/client.cc b/test/cpp/qps/client.cc
deleted file mode 100644
index 11c39eb4f5..0000000000
--- a/test/cpp/qps/client.cc
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <cassert>
-#include <memory>
-#include <string>
-#include <thread>
-#include <vector>
-#include <sstream>
-
-#include <grpc/grpc.h>
-#include <grpc/support/histogram.h>
-#include <grpc/support/log.h>
-#include <gflags/gflags.h>
-#include <grpc++/client_context.h>
-#include <grpc++/status.h>
-#include "test/core/util/grpc_profiler.h"
-#include "test/cpp/util/create_test_channel.h"
-#include "test/cpp/qps/qpstest.pb.h"
-
-DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls.");
-DEFINE_int32(server_port, 0, "Server port.");
-DEFINE_string(server_host, "127.0.0.1", "Server host.");
-DEFINE_int32(client_threads, 4, "Number of client threads.");
-
-// We have a configurable number of channels for sending RPCs.
-// RPCs are sent round-robin on the available channels by the
-// various threads. Interesting cases are 1 global channel or
-// 1 per-thread channel, but we can support any number.
-// The channels are assigned round-robin on an RPC by RPC basis
-// rather than just at initialization time in order to also measure the
-// impact of cache thrashing caused by channel changes. This is an issue
-// if you are not in one of the above "interesting cases"
-DEFINE_int32(client_channels, 4, "Number of client channels.");
-
-DEFINE_int32(num_rpcs, 1000, "Number of RPCs per thread.");
-DEFINE_int32(payload_size, 1, "Payload size in bytes");
-
-// Alternatively, specify parameters for test as a workload so that multiple
-// tests are initiated back-to-back. This is convenient for keeping a borg
-// allocation consistent. This is a space-separated list of
-// [threads channels num_rpcs payload_size ]*
-DEFINE_string(workload, "", "Workload parameters");
-
-using grpc::ChannelInterface;
-using grpc::CreateTestChannel;
-using grpc::testing::ServerStats;
-using grpc::testing::SimpleRequest;
-using grpc::testing::SimpleResponse;
-using grpc::testing::StatsRequest;
-using grpc::testing::TestService;
-
-// In some distros, gflags is in the namespace google, and in some others,
-// in gflags. This hack is enabling us to find both.
-namespace google { }
-namespace gflags { }
-using namespace google;
-using namespace gflags;
-
-static double now() {
- gpr_timespec tv = gpr_now();
- return 1e9 * tv.tv_sec + tv.tv_nsec;
-}
-
-void RunTest(const int client_threads, const int client_channels,
- const int num_rpcs, const int payload_size) {
- gpr_log(GPR_INFO,
- "QPS test with parameters\n"
- "enable_ssl = %d\n"
- "client_channels = %d\n"
- "client_threads = %d\n"
- "num_rpcs = %d\n"
- "payload_size = %d\n"
- "server_host:server_port = %s:%d\n\n",
- FLAGS_enable_ssl, client_channels, client_threads, num_rpcs,
- payload_size, FLAGS_server_host.c_str(), FLAGS_server_port);
-
- std::ostringstream oss;
- oss << FLAGS_server_host << ":" << FLAGS_server_port;
-
- class ClientChannelInfo {
- public:
- explicit ClientChannelInfo(const grpc::string &server)
- : channel_(CreateTestChannel(server, FLAGS_enable_ssl)),
- stub_(TestService::NewStub(channel_)) {}
- ChannelInterface *get_channel() { return channel_.get(); }
- TestService::Stub *get_stub() { return stub_.get(); }
-
- private:
- std::shared_ptr<ChannelInterface> channel_;
- std::unique_ptr<TestService::Stub> stub_;
- };
-
- std::vector<ClientChannelInfo> channels;
- for (int i = 0; i < client_channels; i++) {
- channels.push_back(ClientChannelInfo(oss.str()));
- }
-
- std::vector<std::thread> threads; // Will add threads when ready to execute
- std::vector< ::gpr_histogram *> thread_stats(client_threads);
-
- TestService::Stub *stub_stats = channels[0].get_stub();
- grpc::ClientContext context_stats_begin;
- StatsRequest stats_request;
- ServerStats server_stats_begin;
- stats_request.set_test_num(0);
- grpc::Status status_beg = stub_stats->CollectServerStats(
- &context_stats_begin, stats_request, &server_stats_begin);
-
- grpc_profiler_start("qps_client.prof");
-
- for (int i = 0; i < client_threads; i++) {
- gpr_histogram *hist = gpr_histogram_create(0.01, 60e9);
- GPR_ASSERT(hist != NULL);
- thread_stats[i] = hist;
-
- threads.push_back(
- std::thread([hist, client_threads, client_channels, num_rpcs,
- payload_size, &channels](int channel_num) {
- SimpleRequest request;
- SimpleResponse response;
- request.set_response_type(
- grpc::testing::PayloadType::COMPRESSABLE);
- request.set_response_size(payload_size);
-
- for (int j = 0; j < num_rpcs; j++) {
- TestService::Stub *stub =
- channels[channel_num].get_stub();
- double start = now();
- grpc::ClientContext context;
- grpc::Status s =
- stub->UnaryCall(&context, request, &response);
- gpr_histogram_add(hist, now() - start);
-
- GPR_ASSERT((s.code() == grpc::StatusCode::OK) &&
- (response.payload().type() ==
- grpc::testing::PayloadType::COMPRESSABLE) &&
- (response.payload().body().length() ==
- static_cast<size_t>(payload_size)));
-
- // Now do runtime round-robin assignment of the next
- // channel number
- channel_num += client_threads;
- channel_num %= client_channels;
- }
- },
- i % client_channels));
- }
-
- gpr_histogram *hist = gpr_histogram_create(0.01, 60e9);
- GPR_ASSERT(hist != NULL);
- for (auto &t : threads) {
- t.join();
- }
-
- grpc_profiler_stop();
-
- for (int i = 0; i < client_threads; i++) {
- gpr_histogram *h = thread_stats[i];
- gpr_log(GPR_INFO, "latency at thread %d (50/90/95/99/99.9): %f/%f/%f/%f/%f",
- i, gpr_histogram_percentile(h, 50), gpr_histogram_percentile(h, 90),
- gpr_histogram_percentile(h, 95), gpr_histogram_percentile(h, 99),
- gpr_histogram_percentile(h, 99.9));
- gpr_histogram_merge(hist, h);
- gpr_histogram_destroy(h);
- }
-
- gpr_log(
- GPR_INFO,
- "latency across %d threads with %d channels and %d payload "
- "(50/90/95/99/99.9): %f / %f / %f / %f / %f",
- client_threads, client_channels, payload_size,
- gpr_histogram_percentile(hist, 50), gpr_histogram_percentile(hist, 90),
- gpr_histogram_percentile(hist, 95), gpr_histogram_percentile(hist, 99),
- gpr_histogram_percentile(hist, 99.9));
- gpr_histogram_destroy(hist);
-
- grpc::ClientContext context_stats_end;
- ServerStats server_stats_end;
- grpc::Status status_end = stub_stats->CollectServerStats(
- &context_stats_end, stats_request, &server_stats_end);
-
- double elapsed = server_stats_end.time_now() - server_stats_begin.time_now();
- int total_rpcs = client_threads * num_rpcs;
- double utime = server_stats_end.time_user() - server_stats_begin.time_user();
- double stime =
- server_stats_end.time_system() - server_stats_begin.time_system();
- gpr_log(GPR_INFO,
- "Elapsed time: %.3f\n"
- "RPC Count: %d\n"
- "QPS: %.3f\n"
- "System time: %.3f\n"
- "User time: %.3f\n"
- "Resource usage: %.1f%%\n",
- elapsed, total_rpcs, total_rpcs / elapsed, stime, utime,
- (stime + utime) / elapsed * 100.0);
-}
-
-int main(int argc, char **argv) {
- grpc_init();
- ParseCommandLineFlags(&argc, &argv, true);
-
- GPR_ASSERT(FLAGS_server_port);
-
- if (FLAGS_workload.length() == 0) {
- RunTest(FLAGS_client_threads, FLAGS_client_channels, FLAGS_num_rpcs,
- FLAGS_payload_size);
- } else {
- std::istringstream workload(FLAGS_workload);
- int client_threads, client_channels, num_rpcs, payload_size;
- workload >> client_threads;
- while (!workload.eof()) {
- workload >> client_channels >> num_rpcs >> payload_size;
- RunTest(client_threads, client_channels, num_rpcs, payload_size);
- workload >> client_threads;
- }
- gpr_log(GPR_INFO, "Done with specified workload.");
- }
-
- grpc_shutdown();
- return 0;
-}
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
new file mode 100644
index 0000000000..221fb30fc5
--- /dev/null
+++ b/test/cpp/qps/client.h
@@ -0,0 +1,173 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TEST_QPS_CLIENT_H
+#define TEST_QPS_CLIENT_H
+
+#include "test/cpp/qps/histogram.h"
+#include "test/cpp/qps/timer.h"
+#include "test/cpp/qps/qpstest.pb.h"
+
+#include <condition_variable>
+#include <mutex>
+
+namespace grpc {
+namespace testing {
+
+class Client {
+ public:
+ explicit Client(const ClientConfig& config) : timer_(new Timer) {
+ for (int i = 0; i < config.client_channels(); i++) {
+ channels_.push_back(ClientChannelInfo(
+ config.server_targets(i % config.server_targets_size()), config));
+ }
+ request_.set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
+ request_.set_response_size(config.payload_size());
+ }
+ virtual ~Client() {}
+
+ ClientStats Mark() {
+ Histogram latencies;
+ std::vector<Histogram> to_merge(threads_.size());
+ for (size_t i = 0; i < threads_.size(); i++) {
+ threads_[i]->BeginSwap(&to_merge[i]);
+ }
+ std::unique_ptr<Timer> timer(new Timer);
+ timer_.swap(timer);
+ for (size_t i = 0; i < threads_.size(); i++) {
+ threads_[i]->EndSwap();
+ latencies.Merge(&to_merge[i]);
+ }
+
+ auto timer_result = timer->Mark();
+
+ ClientStats stats;
+ latencies.FillProto(stats.mutable_latencies());
+ stats.set_time_elapsed(timer_result.wall);
+ stats.set_time_system(timer_result.system);
+ stats.set_time_user(timer_result.user);
+ return stats;
+ }
+
+ protected:
+ SimpleRequest request_;
+
+ class ClientChannelInfo {
+ public:
+ ClientChannelInfo(const grpc::string& target, const ClientConfig& config)
+ : channel_(CreateTestChannel(target, config.enable_ssl())),
+ stub_(TestService::NewStub(channel_)) {}
+ ChannelInterface* get_channel() { return channel_.get(); }
+ TestService::Stub* get_stub() { return stub_.get(); }
+
+ private:
+ std::shared_ptr<ChannelInterface> channel_;
+ std::unique_ptr<TestService::Stub> stub_;
+ };
+ std::vector<ClientChannelInfo> channels_;
+
+ void StartThreads(size_t num_threads) {
+ for (size_t i = 0; i < num_threads; i++) {
+ threads_.emplace_back(new Thread(this, i));
+ }
+ }
+
+ void EndThreads() { threads_.clear(); }
+
+ virtual void ThreadFunc(Histogram* histogram, size_t thread_idx) = 0;
+
+ private:
+ class Thread {
+ public:
+ Thread(Client* client, size_t idx)
+ : done_(false),
+ new_(nullptr),
+ impl_([this, idx, client]() {
+ for (;;) {
+ // run the loop body
+ client->ThreadFunc(&histogram_, idx);
+ // lock, see if we're done
+ std::lock_guard<std::mutex> g(mu_);
+ if (done_) return;
+ // also check if we're marking, and swap out the histogram if so
+ if (new_) {
+ new_->Swap(&histogram_);
+ new_ = nullptr;
+ cv_.notify_one();
+ }
+ }
+ }) {}
+
+ ~Thread() {
+ {
+ std::lock_guard<std::mutex> g(mu_);
+ done_ = true;
+ }
+ impl_.join();
+ }
+
+ void BeginSwap(Histogram* n) {
+ std::lock_guard<std::mutex> g(mu_);
+ new_ = n;
+ }
+
+ void EndSwap() {
+ std::unique_lock<std::mutex> g(mu_);
+ cv_.wait(g, [this]() { return new_ == nullptr; });
+ }
+
+ private:
+ Thread(const Thread&);
+ Thread& operator=(const Thread&);
+
+ TestService::Stub* stub_;
+ ClientConfig config_;
+ std::mutex mu_;
+ std::condition_variable cv_;
+ bool done_;
+ Histogram* new_;
+ Histogram histogram_;
+ std::thread impl_;
+ };
+
+ std::vector<std::unique_ptr<Thread>> threads_;
+ std::unique_ptr<Timer> timer_;
+};
+
+std::unique_ptr<Client> CreateSynchronousClient(const ClientConfig& args);
+std::unique_ptr<Client> CreateAsyncClient(const ClientConfig& args);
+
+} // namespace testing
+} // namespace grpc
+
+#endif
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 9ea9cfe8b9..5eb9ff6521 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -49,86 +49,53 @@
#include "test/core/util/grpc_profiler.h"
#include "test/cpp/util/create_test_channel.h"
#include "test/cpp/qps/qpstest.pb.h"
+#include "test/cpp/qps/timer.h"
+#include "test/cpp/qps/client.h"
-DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls.");
-DEFINE_int32(server_port, 0, "Server port.");
-DEFINE_string(server_host, "127.0.0.1", "Server host.");
-DEFINE_int32(client_threads, 4, "Number of client threads.");
-
-// We have a configurable number of channels for sending RPCs.
-// RPCs are sent round-robin on the available channels by the
-// various threads. Interesting cases are 1 global channel or
-// 1 per-thread channel, but we can support any number.
-// The channels are assigned round-robin on an RPC by RPC basis
-// rather than just at initialization time in order to also measure the
-// impact of cache thrashing caused by channel changes. This is an issue
-// if you are not in one of the above "interesting cases"
-DEFINE_int32(client_channels, 4, "Number of client channels.");
-
-DEFINE_int32(num_rpcs, 1000, "Number of RPCs per thread.");
-DEFINE_int32(payload_size, 1, "Payload size in bytes");
-
-// Alternatively, specify parameters for test as a workload so that multiple
-// tests are initiated back-to-back. This is convenient for keeping a borg
-// allocation consistent. This is a space-separated list of
-// [threads channels num_rpcs payload_size ]*
-DEFINE_string(workload, "", "Workload parameters");
-
-using grpc::ChannelInterface;
-using grpc::CreateTestChannel;
-using grpc::testing::ServerStats;
-using grpc::testing::SimpleRequest;
-using grpc::testing::SimpleResponse;
-using grpc::testing::StatsRequest;
-using grpc::testing::TestService;
-
-// In some distros, gflags is in the namespace google, and in some others,
-// in gflags. This hack is enabling us to find both.
-namespace google {}
-namespace gflags {}
-using namespace google;
-using namespace gflags;
-
-static double now() {
- gpr_timespec tv = gpr_now();
- return 1e9 * tv.tv_sec + tv.tv_nsec;
-}
+namespace grpc {
+namespace testing {
class ClientRpcContext {
public:
ClientRpcContext() {}
virtual ~ClientRpcContext() {}
virtual bool RunNextState() = 0; // do next state, return false if steps done
+ virtual void StartNewClone() = 0;
static void *tag(ClientRpcContext *c) { return reinterpret_cast<void *>(c); }
static ClientRpcContext *detag(void *t) {
return reinterpret_cast<ClientRpcContext *>(t);
}
- virtual void report_stats(gpr_histogram *hist) = 0;
+ virtual void report_stats(Histogram *hist) = 0;
};
+
template <class RequestType, class ResponseType>
class ClientRpcContextUnaryImpl : public ClientRpcContext {
public:
ClientRpcContextUnaryImpl(
- TestService::Stub *stub,
- const RequestType &req,
+ TestService::Stub *stub, const RequestType &req,
std::function<
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
- TestService::Stub *, grpc::ClientContext *, const RequestType &,
- void *)> start_req,
+ TestService::Stub *, grpc::ClientContext *, const RequestType &,
+ void *)> start_req,
std::function<void(grpc::Status, ResponseType *)> on_done)
: context_(),
- stub_(stub),
+ stub_(stub),
req_(req),
response_(),
next_state_(&ClientRpcContextUnaryImpl::ReqSent),
callback_(on_done),
- start_(now()),
+ start_req_(start_req),
+ start_(Timer::Now()),
response_reader_(
- start_req(stub_, &context_, req_, ClientRpcContext::tag(this))) {}
+ start_req(stub_, &context_, req_, ClientRpcContext::tag(this))) {}
~ClientRpcContextUnaryImpl() GRPC_OVERRIDE {}
bool RunNextState() GRPC_OVERRIDE { return (this->*next_state_)(); }
- void report_stats(gpr_histogram *hist) GRPC_OVERRIDE {
- gpr_histogram_add(hist, now() - start_);
+ void report_stats(Histogram *hist) GRPC_OVERRIDE {
+ hist->Add((Timer::Now() - start_) * 1e9);
+ }
+
+ void StartNewClone() {
+ new ClientRpcContextUnaryImpl(stub_, req_, start_req_, callback_);
}
private:
@@ -151,191 +118,84 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
ResponseType response_;
bool (ClientRpcContextUnaryImpl::*next_state_)();
std::function<void(grpc::Status, ResponseType *)> callback_;
+ std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
+ TestService::Stub *, grpc::ClientContext *, const RequestType &, void *)>
+ start_req_;
grpc::Status status_;
double start_;
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>
response_reader_;
};
-static void RunTest(const int client_threads, const int client_channels,
- const int num_rpcs, const int payload_size) {
- gpr_log(GPR_INFO,
- "QPS test with parameters\n"
- "enable_ssl = %d\n"
- "client_channels = %d\n"
- "client_threads = %d\n"
- "num_rpcs = %d\n"
- "payload_size = %d\n"
- "server_host:server_port = %s:%d\n\n",
- FLAGS_enable_ssl, client_channels, client_threads, num_rpcs,
- payload_size, FLAGS_server_host.c_str(), FLAGS_server_port);
-
- std::ostringstream oss;
- oss << FLAGS_server_host << ":" << FLAGS_server_port;
-
- class ClientChannelInfo {
- public:
- explicit ClientChannelInfo(const grpc::string &server)
- : channel_(CreateTestChannel(server, FLAGS_enable_ssl)),
- stub_(TestService::NewStub(channel_)) {}
- ChannelInterface *get_channel() { return channel_.get(); }
- TestService::Stub *get_stub() { return stub_.get(); }
+class AsyncClient GRPC_FINAL : public Client {
+ public:
+ explicit AsyncClient(const ClientConfig &config) : Client(config) {
+ for (int i = 0; i < config.async_client_threads(); i++) {
+ cli_cqs_.emplace_back(new CompletionQueue);
+ }
- private:
- std::shared_ptr<ChannelInterface> channel_;
- std::unique_ptr<TestService::Stub> stub_;
- };
+ auto payload_size = config.payload_size();
+ auto check_done = [payload_size](grpc::Status s, SimpleResponse *response) {
+ GPR_ASSERT(s.IsOk() && (response->payload().type() ==
+ grpc::testing::PayloadType::COMPRESSABLE) &&
+ (response->payload().body().length() ==
+ static_cast<size_t>(payload_size)));
+ };
+
+ int t = 0;
+ for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) {
+ for (auto &channel : channels_) {
+ auto *cq = cli_cqs_[t].get();
+ t = (t + 1) % cli_cqs_.size();
+ auto start_req = [cq](TestService::Stub *stub, grpc::ClientContext *ctx,
+ const SimpleRequest &request, void *tag) {
+ return stub->AsyncUnaryCall(ctx, request, cq, tag);
+ };
+
+ TestService::Stub *stub = channel.get_stub();
+ const SimpleRequest &request = request_;
+ new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(
+ stub, request, start_req, check_done);
+ }
+ }
- std::vector<ClientChannelInfo> channels;
- for (int i = 0; i < client_channels; i++) {
- channels.push_back(ClientChannelInfo(oss.str()));
+ StartThreads(config.async_client_threads());
}
- std::vector<std::thread> threads; // Will add threads when ready to execute
- std::vector< ::gpr_histogram *> thread_stats(client_threads);
-
- TestService::Stub *stub_stats = channels[0].get_stub();
- grpc::ClientContext context_stats_begin;
- StatsRequest stats_request;
- ServerStats server_stats_begin;
- stats_request.set_test_num(0);
- grpc::Status status_beg = stub_stats->CollectServerStats(
- &context_stats_begin, stats_request, &server_stats_begin);
-
- grpc_profiler_start("qps_client_async.prof");
-
- auto CheckDone = [=](grpc::Status s, SimpleResponse *response) {
- GPR_ASSERT(s.IsOk() && (response->payload().type() ==
- grpc::testing::PayloadType::COMPRESSABLE) &&
- (response->payload().body().length() ==
- static_cast<size_t>(payload_size)));
- };
+ ~AsyncClient() GRPC_OVERRIDE {
+ EndThreads();
- for (int i = 0; i < client_threads; i++) {
- gpr_histogram *hist = gpr_histogram_create(0.01, 60e9);
- GPR_ASSERT(hist != NULL);
- thread_stats[i] = hist;
-
- threads.push_back(std::thread(
- [hist, client_threads, client_channels, num_rpcs, payload_size,
- &channels, &CheckDone](int channel_num) {
- using namespace std::placeholders;
- SimpleRequest request;
- request.set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
- request.set_response_size(payload_size);
-
- grpc::CompletionQueue cli_cq;
- auto start_req = std::bind(&TestService::Stub::AsyncUnaryCall, _1,
- _2, _3, &cli_cq, _4);
-
- int rpcs_sent = 0;
- while (rpcs_sent < num_rpcs) {
- rpcs_sent++;
- TestService::Stub *stub = channels[channel_num].get_stub();
- new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(stub,
- request, start_req, CheckDone);
- void *got_tag;
- bool ok;
-
- // Need to call 2 next for every 1 RPC (1 for req done, 1 for resp
- // done)
- cli_cq.Next(&got_tag, &ok);
- if (!ok) break;
- ClientRpcContext *ctx = ClientRpcContext::detag(got_tag);
- if (ctx->RunNextState() == false) {
- // call the callback and then delete it
- ctx->report_stats(hist);
- ctx->RunNextState();
- delete ctx;
- }
- cli_cq.Next(&got_tag, &ok);
- if (!ok) break;
- ctx = ClientRpcContext::detag(got_tag);
- if (ctx->RunNextState() == false) {
- // call the callback and then delete it
- ctx->report_stats(hist);
- ctx->RunNextState();
- delete ctx;
- }
- // Now do runtime round-robin assignment of the next
- // channel number
- channel_num += client_threads;
- channel_num %= client_channels;
- }
- },
- i % client_channels));
- }
-
- gpr_histogram *hist = gpr_histogram_create(0.01, 60e9);
- GPR_ASSERT(hist != NULL);
- for (auto &t : threads) {
- t.join();
+ for (auto &cq : cli_cqs_) {
+ cq->Shutdown();
+ void *got_tag;
+ bool ok;
+ while (cq->Next(&got_tag, &ok)) {
+ delete ClientRpcContext::detag(got_tag);
+ }
+ }
}
- grpc_profiler_stop();
-
- for (int i = 0; i < client_threads; i++) {
- gpr_histogram *h = thread_stats[i];
- gpr_log(GPR_INFO, "latency at thread %d (50/90/95/99/99.9): %f/%f/%f/%f/%f",
- i, gpr_histogram_percentile(h, 50), gpr_histogram_percentile(h, 90),
- gpr_histogram_percentile(h, 95), gpr_histogram_percentile(h, 99),
- gpr_histogram_percentile(h, 99.9));
- gpr_histogram_merge(hist, h);
- gpr_histogram_destroy(h);
+ void ThreadFunc(Histogram *histogram, size_t thread_idx) {
+ void *got_tag;
+ bool ok;
+ cli_cqs_[thread_idx]->Next(&got_tag, &ok);
+
+ ClientRpcContext *ctx = ClientRpcContext::detag(got_tag);
+ if (ctx->RunNextState() == false) {
+ // call the callback and then delete it
+ ctx->report_stats(histogram);
+ ctx->RunNextState();
+ ctx->StartNewClone();
+ delete ctx;
+ }
}
- gpr_log(
- GPR_INFO,
- "latency across %d threads with %d channels and %d payload "
- "(50/90/95/99/99.9): %f / %f / %f / %f / %f",
- client_threads, client_channels, payload_size,
- gpr_histogram_percentile(hist, 50), gpr_histogram_percentile(hist, 90),
- gpr_histogram_percentile(hist, 95), gpr_histogram_percentile(hist, 99),
- gpr_histogram_percentile(hist, 99.9));
- gpr_histogram_destroy(hist);
-
- grpc::ClientContext context_stats_end;
- ServerStats server_stats_end;
- grpc::Status status_end = stub_stats->CollectServerStats(
- &context_stats_end, stats_request, &server_stats_end);
+ std::vector<std::unique_ptr<CompletionQueue>> cli_cqs_;
+};
- double elapsed = server_stats_end.time_now() - server_stats_begin.time_now();
- int total_rpcs = client_threads * num_rpcs;
- double utime = server_stats_end.time_user() - server_stats_begin.time_user();
- double stime =
- server_stats_end.time_system() - server_stats_begin.time_system();
- gpr_log(GPR_INFO,
- "Elapsed time: %.3f\n"
- "RPC Count: %d\n"
- "QPS: %.3f\n"
- "System time: %.3f\n"
- "User time: %.3f\n"
- "Resource usage: %.1f%%\n",
- elapsed, total_rpcs, total_rpcs / elapsed, stime, utime,
- (stime + utime) / elapsed * 100.0);
+std::unique_ptr<Client> CreateAsyncClient(const ClientConfig &args) {
+ return std::unique_ptr<Client>(new AsyncClient(args));
}
-int main(int argc, char **argv) {
- grpc_init();
- ParseCommandLineFlags(&argc, &argv, true);
-
- GPR_ASSERT(FLAGS_server_port);
-
- if (FLAGS_workload.length() == 0) {
- RunTest(FLAGS_client_threads, FLAGS_client_channels, FLAGS_num_rpcs,
- FLAGS_payload_size);
- } else {
- std::istringstream workload(FLAGS_workload);
- int client_threads, client_channels, num_rpcs, payload_size;
- workload >> client_threads;
- while (!workload.eof()) {
- workload >> client_channels >> num_rpcs >> payload_size;
- RunTest(client_threads, client_channels, num_rpcs, payload_size);
- workload >> client_threads;
- }
- gpr_log(GPR_INFO, "Done with specified workload.");
- }
-
- grpc_shutdown();
- return 0;
-}
+} // namespace testing
+} // namespace grpc
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
new file mode 100644
index 0000000000..7bb7231c6f
--- /dev/null
+++ b/test/cpp/qps/client_sync.cc
@@ -0,0 +1,93 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <cassert>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <thread>
+#include <vector>
+#include <sstream>
+
+#include <sys/signal.h>
+
+#include <grpc/grpc.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/histogram.h>
+#include <grpc/support/log.h>
+#include <grpc/support/host_port.h>
+#include <gflags/gflags.h>
+#include <grpc++/client_context.h>
+#include <grpc++/status.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
+#include "test/core/util/grpc_profiler.h"
+#include "test/cpp/util/create_test_channel.h"
+#include "test/cpp/qps/client.h"
+#include "test/cpp/qps/qpstest.pb.h"
+#include "test/cpp/qps/histogram.h"
+#include "test/cpp/qps/timer.h"
+
+namespace grpc {
+namespace testing {
+
+class SynchronousClient GRPC_FINAL : public Client {
+ public:
+ SynchronousClient(const ClientConfig& config) : Client(config) {
+ size_t num_threads =
+ config.outstanding_rpcs_per_channel() * config.client_channels();
+ responses_.resize(num_threads);
+ StartThreads(num_threads);
+ }
+
+ ~SynchronousClient() { EndThreads(); }
+
+ void ThreadFunc(Histogram* histogram, size_t thread_idx) {
+ auto* stub = channels_[thread_idx % channels_.size()].get_stub();
+ double start = Timer::Now();
+ grpc::ClientContext context;
+ grpc::Status s =
+ stub->UnaryCall(&context, request_, &responses_[thread_idx]);
+ histogram->Add((Timer::Now() - start) * 1e9);
+ }
+
+ private:
+ std::vector<SimpleResponse> responses_;
+};
+
+std::unique_ptr<Client> CreateSynchronousClient(const ClientConfig& config) {
+ return std::unique_ptr<Client>(new SynchronousClient(config));
+}
+
+} // namespace testing
+} // namespace grpc
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
new file mode 100644
index 0000000000..d29ca1de94
--- /dev/null
+++ b/test/cpp/qps/driver.cc
@@ -0,0 +1,210 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "test/cpp/qps/driver.h"
+#include "src/core/support/env.h"
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/host_port.h>
+#include <grpc++/channel_arguments.h>
+#include <grpc++/client_context.h>
+#include <grpc++/create_channel.h>
+#include <grpc++/stream.h>
+#include <list>
+#include <thread>
+#include <vector>
+#include "test/cpp/qps/histogram.h"
+
+using std::list;
+using std::thread;
+using std::unique_ptr;
+using std::vector;
+
+namespace grpc {
+namespace testing {
+static vector<string> get_hosts(const string& name) {
+ char* env = gpr_getenv(name.c_str());
+ if (!env) return vector<string>();
+
+ vector<string> out;
+ char* p = env;
+ for (;;) {
+ char* comma = strchr(p, ',');
+ if (comma) {
+ out.emplace_back(p, comma);
+ p = comma + 1;
+ } else {
+ out.emplace_back(p);
+ gpr_free(env);
+ return out;
+ }
+ }
+}
+
+ScenarioResult RunScenario(const ClientConfig& initial_client_config,
+ size_t num_clients,
+ const ServerConfig& server_config,
+ size_t num_servers) {
+ // ClientContext allocator (all are destroyed at scope exit)
+ list<ClientContext> contexts;
+ auto alloc_context = [&contexts]() {
+ contexts.emplace_back();
+ return &contexts.back();
+ };
+
+ // Get client, server lists
+ auto workers = get_hosts("QPS_WORKERS");
+ ClientConfig client_config = initial_client_config;
+
+ // TODO(ctiller): support running multiple configurations, and binpack
+ // client/server pairs
+ // to available workers
+ GPR_ASSERT(workers.size() >= num_clients + num_servers);
+
+ // Trim to just what we need
+ workers.resize(num_clients + num_servers);
+
+ // Start servers
+ struct ServerData {
+ unique_ptr<Worker::Stub> stub;
+ unique_ptr<ClientReaderWriter<ServerArgs, ServerStatus>> stream;
+ };
+ vector<ServerData> servers;
+ for (size_t i = 0; i < num_servers; i++) {
+ ServerData sd;
+ sd.stub = std::move(Worker::NewStub(
+ CreateChannel(workers[i], InsecureCredentials(), ChannelArguments())));
+ ServerArgs args;
+ *args.mutable_setup() = server_config;
+ sd.stream = std::move(sd.stub->RunServer(alloc_context()));
+ GPR_ASSERT(sd.stream->Write(args));
+ ServerStatus init_status;
+ GPR_ASSERT(sd.stream->Read(&init_status));
+ char* host;
+ char* driver_port;
+ char* cli_target;
+ gpr_split_host_port(workers[i].c_str(), &host, &driver_port);
+ gpr_join_host_port(&cli_target, host, init_status.port());
+ client_config.add_server_targets(cli_target);
+ gpr_free(host);
+ gpr_free(driver_port);
+ gpr_free(cli_target);
+
+ servers.push_back(std::move(sd));
+ }
+
+ // Start clients
+ struct ClientData {
+ unique_ptr<Worker::Stub> stub;
+ unique_ptr<ClientReaderWriter<ClientArgs, ClientStatus>> stream;
+ };
+ vector<ClientData> clients;
+ for (size_t i = 0; i < num_clients; i++) {
+ ClientData cd;
+ cd.stub = std::move(Worker::NewStub(CreateChannel(
+ workers[i + num_servers], InsecureCredentials(), ChannelArguments())));
+ ClientArgs args;
+ *args.mutable_setup() = client_config;
+ cd.stream = std::move(cd.stub->RunTest(alloc_context()));
+ GPR_ASSERT(cd.stream->Write(args));
+ ClientStatus init_status;
+ GPR_ASSERT(cd.stream->Read(&init_status));
+
+ clients.push_back(std::move(cd));
+ }
+
+ // Let everything warmup
+ gpr_log(GPR_INFO, "Warming up");
+ gpr_timespec start = gpr_now();
+ gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(5)));
+
+ // Start a run
+ gpr_log(GPR_INFO, "Starting");
+ ServerArgs server_mark;
+ server_mark.mutable_mark();
+ ClientArgs client_mark;
+ client_mark.mutable_mark();
+ for (auto& server : servers) {
+ GPR_ASSERT(server.stream->Write(server_mark));
+ }
+ for (auto& client : clients) {
+ GPR_ASSERT(client.stream->Write(client_mark));
+ }
+ ServerStatus server_status;
+ ClientStatus client_status;
+ for (auto& server : servers) {
+ GPR_ASSERT(server.stream->Read(&server_status));
+ }
+ for (auto& client : clients) {
+ GPR_ASSERT(client.stream->Read(&client_status));
+ }
+
+ // Wait some time
+ gpr_log(GPR_INFO, "Running");
+ gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(15)));
+
+ // Finish a run
+ ScenarioResult result;
+ gpr_log(GPR_INFO, "Finishing");
+ for (auto& server : servers) {
+ GPR_ASSERT(server.stream->Write(server_mark));
+ }
+ for (auto& client : clients) {
+ GPR_ASSERT(client.stream->Write(client_mark));
+ }
+ for (auto& server : servers) {
+ GPR_ASSERT(server.stream->Read(&server_status));
+ const auto& stats = server_status.stats();
+ result.server_resources.push_back(ResourceUsage{
+ stats.time_elapsed(), stats.time_user(), stats.time_system()});
+ }
+ for (auto& client : clients) {
+ GPR_ASSERT(client.stream->Read(&client_status));
+ const auto& stats = client_status.stats();
+ result.latencies.MergeProto(stats.latencies());
+ result.client_resources.push_back(ResourceUsage{
+ stats.time_elapsed(), stats.time_user(), stats.time_system()});
+ }
+
+ for (auto& client : clients) {
+ GPR_ASSERT(client.stream->WritesDone());
+ GPR_ASSERT(client.stream->Finish().IsOk());
+ }
+ for (auto& server : servers) {
+ GPR_ASSERT(server.stream->WritesDone());
+ GPR_ASSERT(server.stream->Finish().IsOk());
+ }
+ return result;
+}
+} // namespace testing
+} // namespace grpc
diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h
new file mode 100644
index 0000000000..d87e80dc55
--- /dev/null
+++ b/test/cpp/qps/driver.h
@@ -0,0 +1,61 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TEST_QPS_DRIVER_H
+#define TEST_QPS_DRIVER_H
+
+#include "test/cpp/qps/histogram.h"
+#include "test/cpp/qps/qpstest.pb.h"
+
+namespace grpc {
+namespace testing {
+struct ResourceUsage {
+ double wall_time;
+ double user_time;
+ double system_time;
+};
+
+struct ScenarioResult {
+ Histogram latencies;
+ std::vector<ResourceUsage> client_resources;
+ std::vector<ResourceUsage> server_resources;
+};
+
+ScenarioResult RunScenario(const grpc::testing::ClientConfig& client_config,
+ size_t num_clients,
+ const grpc::testing::ServerConfig& server_config,
+ size_t num_servers);
+} // namespace testing
+} // namespace grpc
+
+#endif
diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h
new file mode 100644
index 0000000000..7ba00e94c3
--- /dev/null
+++ b/test/cpp/qps/histogram.h
@@ -0,0 +1,85 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TEST_QPS_HISTOGRAM_H
+#define TEST_QPS_HISTOGRAM_H
+
+#include <grpc/support/histogram.h>
+#include "test/cpp/qps/qpstest.pb.h"
+
+namespace grpc {
+namespace testing {
+
+class Histogram {
+ public:
+ Histogram() : impl_(gpr_histogram_create(0.01, 60e9)) {}
+ ~Histogram() {
+ if (impl_) gpr_histogram_destroy(impl_);
+ }
+ Histogram(Histogram&& other) : impl_(other.impl_) { other.impl_ = nullptr; }
+
+ void Merge(Histogram* h) { gpr_histogram_merge(impl_, h->impl_); }
+ void Add(double value) { gpr_histogram_add(impl_, value); }
+ double Percentile(double pctile) {
+ return gpr_histogram_percentile(impl_, pctile);
+ }
+ double Count() { return gpr_histogram_count(impl_); }
+ void Swap(Histogram* other) { std::swap(impl_, other->impl_); }
+ void FillProto(HistogramData* p) {
+ size_t n;
+ const auto* data = gpr_histogram_get_contents(impl_, &n);
+ for (size_t i = 0; i < n; i++) {
+ p->add_bucket(data[i]);
+ }
+ p->set_min_seen(gpr_histogram_minimum(impl_));
+ p->set_max_seen(gpr_histogram_maximum(impl_));
+ p->set_sum(gpr_histogram_sum(impl_));
+ p->set_sum_of_squares(gpr_histogram_sum_of_squares(impl_));
+ p->set_count(gpr_histogram_count(impl_));
+ }
+ void MergeProto(const HistogramData& p) {
+ gpr_histogram_merge_contents(impl_, &*p.bucket().begin(), p.bucket_size(),
+ p.min_seen(), p.max_seen(), p.sum(),
+ p.sum_of_squares(), p.count());
+ }
+
+ private:
+ Histogram(const Histogram&);
+ Histogram& operator=(const Histogram&);
+
+ gpr_histogram* impl_;
+};
+}
+}
+
+#endif /* TEST_QPS_HISTOGRAM_H */
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
new file mode 100644
index 0000000000..bf51e7408e
--- /dev/null
+++ b/test/cpp/qps/qps_driver.cc
@@ -0,0 +1,132 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <gflags/gflags.h>
+#include <grpc/support/log.h>
+
+#include "test/cpp/qps/driver.h"
+#include "test/cpp/qps/stats.h"
+
+DEFINE_int32(num_clients, 1, "Number of client binaries");
+DEFINE_int32(num_servers, 1, "Number of server binaries");
+
+// Common config
+DEFINE_bool(enable_ssl, false, "Use SSL");
+
+// Server config
+DEFINE_int32(server_threads, 1, "Number of server threads");
+DEFINE_string(server_type, "SYNCHRONOUS_SERVER", "Server type");
+
+// Client config
+DEFINE_int32(outstanding_rpcs_per_channel, 1,
+ "Number of outstanding rpcs per channel");
+DEFINE_int32(client_channels, 1, "Number of client channels");
+DEFINE_int32(payload_size, 1, "Payload size");
+DEFINE_string(client_type, "SYNCHRONOUS_CLIENT", "Client type");
+DEFINE_int32(async_client_threads, 1, "Async client threads");
+
+using grpc::testing::ClientConfig;
+using grpc::testing::ServerConfig;
+using grpc::testing::ClientType;
+using grpc::testing::ServerType;
+using grpc::testing::ResourceUsage;
+using grpc::testing::sum;
+
+// In some distros, gflags is in the namespace google, and in some others,
+// in gflags. This hack is enabling us to find both.
+namespace google {}
+namespace gflags {}
+using namespace google;
+using namespace gflags;
+
+int main(int argc, char **argv) {
+ grpc_init();
+ ParseCommandLineFlags(&argc, &argv, true);
+
+ ClientType client_type;
+ ServerType server_type;
+ GPR_ASSERT(ClientType_Parse(FLAGS_client_type, &client_type));
+ GPR_ASSERT(ServerType_Parse(FLAGS_server_type, &server_type));
+
+ ClientConfig client_config;
+ client_config.set_client_type(client_type);
+ client_config.set_enable_ssl(FLAGS_enable_ssl);
+ client_config.set_outstanding_rpcs_per_channel(
+ FLAGS_outstanding_rpcs_per_channel);
+ client_config.set_client_channels(FLAGS_client_channels);
+ client_config.set_payload_size(FLAGS_payload_size);
+ client_config.set_async_client_threads(FLAGS_async_client_threads);
+
+ ServerConfig server_config;
+ server_config.set_server_type(server_type);
+ server_config.set_threads(FLAGS_server_threads);
+ server_config.set_enable_ssl(FLAGS_enable_ssl);
+
+ auto result = RunScenario(client_config, FLAGS_num_clients, server_config,
+ FLAGS_num_servers);
+
+ gpr_log(GPR_INFO, "QPS: %.1f",
+ result.latencies.Count() /
+ average(result.client_resources,
+ [](ResourceUsage u) { return u.wall_time; }));
+
+ gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us",
+ result.latencies.Percentile(50) / 1000,
+ result.latencies.Percentile(95) / 1000,
+ result.latencies.Percentile(99) / 1000,
+ result.latencies.Percentile(99.9) / 1000);
+
+ gpr_log(GPR_INFO, "Server system time: %.2f%%",
+ 100.0 * sum(result.server_resources,
+ [](ResourceUsage u) { return u.system_time; }) /
+ sum(result.server_resources,
+ [](ResourceUsage u) { return u.wall_time; }));
+ gpr_log(GPR_INFO, "Server user time: %.2f%%",
+ 100.0 * sum(result.server_resources,
+ [](ResourceUsage u) { return u.user_time; }) /
+ sum(result.server_resources,
+ [](ResourceUsage u) { return u.wall_time; }));
+ gpr_log(GPR_INFO, "Client system time: %.2f%%",
+ 100.0 * sum(result.client_resources,
+ [](ResourceUsage u) { return u.system_time; }) /
+ sum(result.client_resources,
+ [](ResourceUsage u) { return u.wall_time; }));
+ gpr_log(GPR_INFO, "Client user time: %.2f%%",
+ 100.0 * sum(result.client_resources,
+ [](ResourceUsage u) { return u.user_time; }) /
+ sum(result.client_resources,
+ [](ResourceUsage u) { return u.wall_time; }));
+
+ grpc_shutdown();
+ return 0;
+}
diff --git a/test/cpp/qps/qpstest.proto b/test/cpp/qps/qpstest.proto
index 68ec6149f5..6a7170bf58 100644
--- a/test/cpp/qps/qpstest.proto
+++ b/test/cpp/qps/qpstest.proto
@@ -51,17 +51,14 @@ message StatsRequest {
}
message ServerStats {
- // wall clock time for timestamp
- required double time_now = 1;
+ // wall clock time
+ required double time_elapsed = 1;
// user time used by the server process and threads
required double time_user = 2;
// server time used by the server process and all threads
required double time_system = 3;
-
- // RPC count so far
- optional int32 num_rpcs = 4;
}
message Payload {
@@ -71,31 +68,75 @@ message Payload {
optional bytes body = 2;
}
-message Latencies {
- required double l_50 = 1;
- required double l_90 = 2;
- required double l_99 = 3;
- required double l_999 = 4;
+message HistogramData {
+ repeated uint32 bucket = 1;
+ required double min_seen = 2;
+ required double max_seen = 3;
+ required double sum = 4;
+ required double sum_of_squares = 5;
+ required double count = 6;
+}
+
+enum ClientType {
+ SYNCHRONOUS_CLIENT = 1;
+ ASYNC_CLIENT = 2;
+}
+
+enum ServerType {
+ SYNCHRONOUS_SERVER = 1;
+ ASYNC_SERVER = 2;
+}
+
+message ClientConfig {
+ repeated string server_targets = 1;
+ required ClientType client_type = 2;
+ required bool enable_ssl = 3;
+ required int32 outstanding_rpcs_per_channel = 4;
+ required int32 client_channels = 5;
+ required int32 payload_size = 6;
+ // only for async client:
+ optional int32 async_client_threads = 7;
}
-message StartArgs {
- required string server_host = 1;
- required int32 server_port = 2;
- optional bool enable_ssl = 3 [default = false];
- optional int32 client_threads = 4 [default = 1];
- optional int32 client_channels = 5 [default = -1];
- optional int32 num_rpcs = 6 [default = 1];
- optional int32 payload_size = 7 [default = 1];
+// Request current stats
+message Mark {}
+
+message ClientArgs {
+ oneof argtype {
+ ClientConfig setup = 1;
+ Mark mark = 2;
+ }
}
-message StartResult {
- required Latencies latencies = 1;
- required int32 num_rpcs = 2;
+message ClientStats {
+ required HistogramData latencies = 1;
required double time_elapsed = 3;
required double time_user = 4;
required double time_system = 5;
}
+message ClientStatus {
+ optional ClientStats stats = 1;
+}
+
+message ServerConfig {
+ required ServerType server_type = 1;
+ required int32 threads = 2;
+ required bool enable_ssl = 3;
+}
+
+message ServerArgs {
+ oneof argtype {
+ ServerConfig setup = 1;
+ Mark mark = 2;
+ }
+}
+
+message ServerStatus {
+ optional ServerStats stats = 1;
+ required int32 port = 2;
+}
+
message SimpleRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
@@ -153,12 +194,6 @@ message StreamingOutputCallResponse {
}
service TestService {
- // Start test with specified workload
- rpc StartTest(StartArgs) returns (Latencies);
-
- // Collect stats from server, ignore request content
- rpc CollectServerStats(StatsRequest) returns (ServerStats);
-
// One request followed by one response.
// The server returns the client payload as-is.
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
@@ -186,3 +221,10 @@ service TestService {
rpc HalfDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
}
+
+service Worker {
+ // Start test with specified workload
+ rpc RunTest(stream ClientArgs) returns (stream ClientStatus);
+ // Start test with specified workload
+ rpc RunServer(stream ServerArgs) returns (stream ServerStatus);
+}
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
new file mode 100644
index 0000000000..ef71cb94d0
--- /dev/null
+++ b/test/cpp/qps/server.h
@@ -0,0 +1,84 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TEST_QPS_SERVER_H
+#define TEST_QPS_SERVER_H
+
+#include "test/cpp/qps/timer.h"
+#include "test/cpp/qps/qpstest.pb.h"
+
+namespace grpc {
+namespace testing {
+
+class Server {
+ public:
+ Server() : timer_(new Timer) {}
+ virtual ~Server() {}
+
+ ServerStats Mark() {
+ std::unique_ptr<Timer> timer(new Timer);
+ timer.swap(timer_);
+
+ auto timer_result = timer->Mark();
+
+ ServerStats stats;
+ stats.set_time_elapsed(timer_result.wall);
+ stats.set_time_system(timer_result.system);
+ stats.set_time_user(timer_result.user);
+ return stats;
+ }
+
+ static bool SetPayload(PayloadType type, int size, Payload* payload) {
+ PayloadType response_type = type;
+ // TODO(yangg): Support UNCOMPRESSABLE payload.
+ if (type != PayloadType::COMPRESSABLE) {
+ return false;
+ }
+ payload->set_type(response_type);
+ std::unique_ptr<char[]> body(new char[size]());
+ payload->set_body(body.get(), size);
+ return true;
+ }
+
+ private:
+ std::unique_ptr<Timer> timer_;
+};
+
+std::unique_ptr<Server> CreateSynchronousServer(const ServerConfig& config,
+ int port);
+std::unique_ptr<Server> CreateAsyncServer(const ServerConfig& config, int port);
+
+} // namespace testing
+} // namespace grpc
+
+#endif
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index a7c7f495d2..19778e5a7c 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -52,105 +52,38 @@
#include "src/cpp/server/thread_pool.h"
#include "test/core/util/grpc_profiler.h"
#include "test/cpp/qps/qpstest.pb.h"
+#include "test/cpp/qps/server.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
-DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls.");
-DEFINE_int32(port, 0, "Server port.");
-DEFINE_int32(server_threads, 4, "Number of server threads.");
+namespace grpc {
+namespace testing {
-using grpc::CompletionQueue;
-using grpc::InsecureServerCredentials;
-using grpc::Server;
-using grpc::ServerBuilder;
-using grpc::ServerContext;
-using grpc::ThreadPool;
-using grpc::testing::Payload;
-using grpc::testing::PayloadType;
-using grpc::testing::ServerStats;
-using grpc::testing::SimpleRequest;
-using grpc::testing::SimpleResponse;
-using grpc::testing::StatsRequest;
-using grpc::testing::TestService;
-using grpc::Status;
-
-// In some distros, gflags is in the namespace google, and in some others,
-// in gflags. This hack is enabling us to find both.
-namespace google {}
-namespace gflags {}
-using namespace google;
-using namespace gflags;
-
-static bool got_sigint = false;
-
-static void sigint_handler(int x) { got_sigint = 1; }
-
-static double time_double(struct timeval *tv) {
- return tv->tv_sec + 1e-6 * tv->tv_usec;
-}
-
-static bool SetPayload(PayloadType type, int size, Payload *payload) {
- PayloadType response_type = type;
- // TODO(yangg): Support UNCOMPRESSABLE payload.
- if (type != PayloadType::COMPRESSABLE) {
- return false;
- }
- payload->set_type(response_type);
- std::unique_ptr<char[]> body(new char[size]());
- payload->set_body(body.get(), size);
- return true;
-}
-
-namespace {
-
-class AsyncQpsServerTest {
+class AsyncQpsServerTest : public Server {
public:
- AsyncQpsServerTest() : srv_cq_(), async_service_(&srv_cq_), server_(nullptr) {
+ AsyncQpsServerTest(const ServerConfig &config, int port)
+ : srv_cq_(), async_service_(&srv_cq_), server_(nullptr) {
char *server_address = NULL;
- gpr_join_host_port(&server_address, "::", FLAGS_port);
+ gpr_join_host_port(&server_address, "::", port);
ServerBuilder builder;
builder.AddPort(server_address, InsecureServerCredentials());
+ gpr_free(server_address);
builder.RegisterAsyncService(&async_service_);
server_ = builder.BuildAndStart();
- gpr_log(GPR_INFO, "Server listening on %s\n", server_address);
- gpr_free(server_address);
using namespace std::placeholders;
request_unary_ = std::bind(&TestService::AsyncService::RequestUnaryCall,
&async_service_, _1, _2, _3, &srv_cq_, _4);
- request_stats_ =
- std::bind(&TestService::AsyncService::RequestCollectServerStats,
- &async_service_, _1, _2, _3, &srv_cq_, _4);
for (int i = 0; i < 100; i++) {
contexts_.push_front(
new ServerRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(
request_unary_, UnaryCall));
- contexts_.push_front(
- new ServerRpcContextUnaryImpl<StatsRequest, ServerStats>(
- request_stats_, CollectServerStats));
- }
- }
- ~AsyncQpsServerTest() {
- server_->Shutdown();
- void *ignored_tag;
- bool ignored_ok;
- srv_cq_.Shutdown();
- while (srv_cq_.Next(&ignored_tag, &ignored_ok)) {
}
- while (!contexts_.empty()) {
- delete contexts_.front();
- contexts_.pop_front();
- }
- for (auto& thr: threads_) {
- thr.join();
- }
- }
- void ServeRpcs(int num_threads) {
- for (int i = 0; i < num_threads; i++) {
+ for (int i = 0; i < config.threads(); i++) {
threads_.push_back(std::thread([=]() {
// Wait until work is available or we are shutting down
bool ok;
@@ -168,8 +101,16 @@ class AsyncQpsServerTest {
return;
}));
}
- while (!got_sigint) {
- std::this_thread::sleep_for(std::chrono::seconds(5));
+ }
+ ~AsyncQpsServerTest() {
+ server_->Shutdown();
+ srv_cq_.Shutdown();
+ for (auto &thr : threads_) {
+ thr.join();
+ }
+ while (!contexts_.empty()) {
+ delete contexts_.front();
+ contexts_.pop_front();
}
}
@@ -178,8 +119,8 @@ class AsyncQpsServerTest {
public:
ServerRpcContext() {}
virtual ~ServerRpcContext(){};
- virtual bool RunNextState() = 0;// do next state, return false if all done
- virtual void Reset() = 0; // start this back at a clean state
+ virtual bool RunNextState() = 0; // do next state, return false if all done
+ virtual void Reset() = 0; // start this back at a clean state
};
static void *tag(ServerRpcContext *func) {
return reinterpret_cast<void *>(func);
@@ -242,17 +183,6 @@ class AsyncQpsServerTest {
grpc::ServerAsyncResponseWriter<ResponseType> response_writer_;
};
- static Status CollectServerStats(const StatsRequest *,
- ServerStats *response) {
- struct rusage usage;
- struct timeval tv;
- gettimeofday(&tv, NULL);
- getrusage(RUSAGE_SELF, &usage);
- response->set_time_now(time_double(&tv));
- response->set_time_user(time_double(&usage.ru_utime));
- response->set_time_system(time_double(&usage.ru_stime));
- return Status::OK;
- }
static Status UnaryCall(const SimpleRequest *request,
SimpleResponse *response) {
if (request->has_response_size() && request->response_size() > 0) {
@@ -266,40 +196,17 @@ class AsyncQpsServerTest {
CompletionQueue srv_cq_;
TestService::AsyncService async_service_;
std::vector<std::thread> threads_;
- std::unique_ptr<Server> server_;
+ std::unique_ptr<grpc::Server> server_;
std::function<void(ServerContext *, SimpleRequest *,
grpc::ServerAsyncResponseWriter<SimpleResponse> *, void *)>
request_unary_;
- std::function<void(ServerContext *, StatsRequest *,
- grpc::ServerAsyncResponseWriter<ServerStats> *, void *)>
- request_stats_;
std::forward_list<ServerRpcContext *> contexts_;
};
-} // namespace
-
-static void RunServer() {
- AsyncQpsServerTest server;
-
- grpc_profiler_start("qps_server_async.prof");
-
- server.ServeRpcs(FLAGS_server_threads);
-
- grpc_profiler_stop();
+std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config,
+ int port) {
+ return std::unique_ptr<Server>(new AsyncQpsServerTest(config, port));
}
-int main(int argc, char **argv) {
- grpc_init();
- ParseCommandLineFlags(&argc, &argv, true);
- GPR_ASSERT(FLAGS_port != 0);
- GPR_ASSERT(!FLAGS_enable_ssl);
-
- signal(SIGINT, sigint_handler);
-
- RunServer();
-
- grpc_shutdown();
- google::protobuf::ShutdownProtobufLibrary();
-
- return 0;
-}
+} // namespace testing
+} // namespace grpc
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
new file mode 100644
index 0000000000..5c6541989c
--- /dev/null
+++ b/test/cpp/qps/server_sync.cc
@@ -0,0 +1,108 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <sys/signal.h>
+#include <thread>
+
+#include <unistd.h>
+
+#include <gflags/gflags.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/host_port.h>
+#include <grpc++/config.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
+#include <grpc++/server_context.h>
+#include <grpc++/server_credentials.h>
+#include <grpc++/status.h>
+#include <grpc++/stream.h>
+#include "src/cpp/server/thread_pool.h"
+#include "test/core/util/grpc_profiler.h"
+#include "test/cpp/qps/qpstest.pb.h"
+#include "test/cpp/qps/server.h"
+#include "test/cpp/qps/timer.h"
+
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
+
+namespace grpc {
+namespace testing {
+
+class TestServiceImpl GRPC_FINAL : public TestService::Service {
+ public:
+ Status UnaryCall(ServerContext* context, const SimpleRequest* request,
+ SimpleResponse* response) GRPC_OVERRIDE {
+ if (request->has_response_size() && request->response_size() > 0) {
+ if (!Server::SetPayload(request->response_type(),
+ request->response_size(),
+ response->mutable_payload())) {
+ return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
+ }
+ }
+ return Status::OK;
+ }
+};
+
+class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
+ public:
+ SynchronousServer(const ServerConfig& config, int port)
+ : thread_pool_(config.threads()), impl_(MakeImpl(port)) {}
+
+ private:
+ std::unique_ptr<grpc::Server> MakeImpl(int port) {
+ ServerBuilder builder;
+
+ char* server_address = NULL;
+ gpr_join_host_port(&server_address, "::", port);
+ builder.AddPort(server_address, InsecureServerCredentials());
+ gpr_free(server_address);
+
+ builder.RegisterService(&service_);
+
+ builder.SetThreadPool(&thread_pool_);
+
+ return builder.BuildAndStart();
+ }
+
+ TestServiceImpl service_;
+ ThreadPool thread_pool_;
+ std::unique_ptr<grpc::Server> impl_;
+};
+
+std::unique_ptr<grpc::testing::Server> CreateSynchronousServer(
+ const ServerConfig& config, int port) {
+ return std::unique_ptr<Server>(new SynchronousServer(config, port));
+}
+
+} // namespace testing
+} // namespace grpc
diff --git a/test/cpp/qps/single_run_localhost.sh b/test/cpp/qps/single_run_localhost.sh
new file mode 100755
index 0000000000..2f60b4e49d
--- /dev/null
+++ b/test/cpp/qps/single_run_localhost.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# performs a single qps run with one client and one server
+
+set -ex
+
+cd $(dirname $0)/../../..
+
+killall qps_worker || true
+
+config=opt
+
+NUMCPUS=`python2.7 -c 'import multiprocessing; print multiprocessing.cpu_count()'`
+
+make CONFIG=$config qps_worker qps_driver -j$NUMCPUS
+
+bins/$config/qps_worker -driver_port 10000 -server_port 10001 &
+PID1=$!
+bins/$config/qps_worker -driver_port 10010 -server_port 10011 &
+PID2=$!
+
+export QPS_WORKERS="localhost:10000,localhost:10010"
+
+bins/$config/qps_driver $*
+
+kill -2 $PID1 $PID2
+wait
+
diff --git a/test/cpp/qps/stats.h b/test/cpp/qps/stats.h
new file mode 100644
index 0000000000..ca59390ad7
--- /dev/null
+++ b/test/cpp/qps/stats.h
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TEST_QPS_STATS_UTILS_H
+#define TEST_QPS_STATS_UTILS_H
+
+#include "test/cpp/qps/histogram.h"
+#include <string>
+
+namespace grpc {
+namespace testing {
+
+template <class T, class F>
+double sum(const T& container, F functor) {
+ double r = 0;
+ for (auto v : container) {
+ r += functor(v);
+ }
+ return r;
+}
+
+template <class T, class F>
+double average(const T& container, F functor) {
+ return sum(container, functor) / container.size();
+}
+
+} // namespace testing
+} // namespace grpc
+
+#endif
diff --git a/test/cpp/qps/timer.cc b/test/cpp/qps/timer.cc
new file mode 100644
index 0000000000..3c1342041c
--- /dev/null
+++ b/test/cpp/qps/timer.cc
@@ -0,0 +1,71 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "test/cpp/qps/timer.h"
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <grpc/support/time.h>
+
+Timer::Timer() : start_(Sample()) {}
+
+double Timer::Now() {
+ auto ts = gpr_now();
+ return ts.tv_sec + 1e-9 * ts.tv_nsec;
+}
+
+static double time_double(struct timeval* tv) {
+ return tv->tv_sec + 1e-6 * tv->tv_usec;
+}
+
+Timer::Result Timer::Sample() {
+ struct rusage usage;
+ struct timeval tv;
+ gettimeofday(&tv, nullptr);
+ getrusage(RUSAGE_SELF, &usage);
+
+ Result r;
+ r.wall = time_double(&tv);
+ r.user = time_double(&usage.ru_utime);
+ r.system = time_double(&usage.ru_stime);
+ return r;
+}
+
+Timer::Result Timer::Mark() {
+ Result s = Sample();
+ Result r;
+ r.wall = s.wall - start_.wall;
+ r.user = s.user - start_.user;
+ r.system = s.system - start_.system;
+ return r;
+}
diff --git a/test/cpp/qps/timer.h b/test/cpp/qps/timer.h
new file mode 100644
index 0000000000..30dbd7e7d5
--- /dev/null
+++ b/test/cpp/qps/timer.h
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef TEST_QPS_TIMER_H
+#define TEST_QPS_TIMER_H
+
+class Timer {
+ public:
+ Timer();
+
+ struct Result {
+ double wall;
+ double user;
+ double system;
+ };
+
+ Result Mark();
+
+ static double Now();
+
+ private:
+ static Result Sample();
+
+ const Result start_;
+};
+
+#endif // TEST_QPS_TIMER_H
diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc
new file mode 100644
index 0000000000..faabfd1147
--- /dev/null
+++ b/test/cpp/qps/worker.cc
@@ -0,0 +1,236 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <cassert>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <thread>
+#include <vector>
+#include <sstream>
+
+#include <sys/signal.h>
+
+#include <grpc/grpc.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/histogram.h>
+#include <grpc/support/log.h>
+#include <grpc/support/host_port.h>
+#include <gflags/gflags.h>
+#include <grpc++/client_context.h>
+#include <grpc++/status.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
+#include <grpc++/server_credentials.h>
+#include <grpc++/stream.h>
+#include "test/core/util/grpc_profiler.h"
+#include "test/cpp/util/create_test_channel.h"
+#include "test/cpp/qps/qpstest.pb.h"
+#include "test/cpp/qps/client.h"
+#include "test/cpp/qps/server.h"
+
+DEFINE_int32(driver_port, 0, "Driver server port.");
+DEFINE_int32(server_port, 0, "Spawned server port.");
+
+// In some distros, gflags is in the namespace google, and in some others,
+// in gflags. This hack is enabling us to find both.
+namespace google {}
+namespace gflags {}
+using namespace google;
+using namespace gflags;
+
+static bool got_sigint = false;
+
+namespace grpc {
+namespace testing {
+
+std::unique_ptr<Client> CreateClient(const ClientConfig& config) {
+ switch (config.client_type()) {
+ case ClientType::SYNCHRONOUS_CLIENT:
+ return CreateSynchronousClient(config);
+ case ClientType::ASYNC_CLIENT:
+ return CreateAsyncClient(config);
+ }
+ abort();
+}
+
+std::unique_ptr<Server> CreateServer(const ServerConfig& config) {
+ switch (config.server_type()) {
+ case ServerType::SYNCHRONOUS_SERVER:
+ return CreateSynchronousServer(config, FLAGS_server_port);
+ case ServerType::ASYNC_SERVER:
+ return CreateAsyncServer(config, FLAGS_server_port);
+ }
+ abort();
+}
+
+class WorkerImpl GRPC_FINAL : public Worker::Service {
+ public:
+ WorkerImpl() : acquired_(false) {}
+
+ Status RunTest(ServerContext* ctx,
+ ServerReaderWriter<ClientStatus, ClientArgs>* stream)
+ GRPC_OVERRIDE {
+ InstanceGuard g(this);
+ if (!g.Acquired()) {
+ return Status(RESOURCE_EXHAUSTED);
+ }
+
+ ClientArgs args;
+ if (!stream->Read(&args)) {
+ return Status(INVALID_ARGUMENT);
+ }
+ if (!args.has_setup()) {
+ return Status(INVALID_ARGUMENT);
+ }
+ auto client = CreateClient(args.setup());
+ if (!client) {
+ return Status(INVALID_ARGUMENT);
+ }
+ ClientStatus status;
+ if (!stream->Write(status)) {
+ return Status(UNKNOWN);
+ }
+ while (stream->Read(&args)) {
+ if (!args.has_mark()) {
+ return Status(INVALID_ARGUMENT);
+ }
+ *status.mutable_stats() = client->Mark();
+ stream->Write(status);
+ }
+
+ return Status::OK;
+ }
+
+ Status RunServer(ServerContext* ctx,
+ ServerReaderWriter<ServerStatus, ServerArgs>* stream)
+ GRPC_OVERRIDE {
+ InstanceGuard g(this);
+ if (!g.Acquired()) {
+ return Status(RESOURCE_EXHAUSTED);
+ }
+
+ ServerArgs args;
+ if (!stream->Read(&args)) {
+ return Status(INVALID_ARGUMENT);
+ }
+ if (!args.has_setup()) {
+ return Status(INVALID_ARGUMENT);
+ }
+ auto server = CreateServer(args.setup());
+ if (!server) {
+ return Status(INVALID_ARGUMENT);
+ }
+ ServerStatus status;
+ status.set_port(FLAGS_server_port);
+ if (!stream->Write(status)) {
+ return Status(UNKNOWN);
+ }
+ while (stream->Read(&args)) {
+ if (!args.has_mark()) {
+ return Status(INVALID_ARGUMENT);
+ }
+ *status.mutable_stats() = server->Mark();
+ stream->Write(status);
+ }
+
+ return Status::OK;
+ }
+
+ private:
+ // Protect against multiple clients using this worker at once.
+ class InstanceGuard {
+ public:
+ InstanceGuard(WorkerImpl* impl)
+ : impl_(impl), acquired_(impl->TryAcquireInstance()) {}
+ ~InstanceGuard() {
+ if (acquired_) {
+ impl_->ReleaseInstance();
+ }
+ }
+
+ bool Acquired() const { return acquired_; }
+
+ private:
+ WorkerImpl* const impl_;
+ const bool acquired_;
+ };
+
+ bool TryAcquireInstance() {
+ std::lock_guard<std::mutex> g(mu_);
+ if (acquired_) return false;
+ acquired_ = true;
+ return true;
+ }
+
+ void ReleaseInstance() {
+ std::lock_guard<std::mutex> g(mu_);
+ GPR_ASSERT(acquired_);
+ acquired_ = false;
+ }
+
+ std::mutex mu_;
+ bool acquired_;
+};
+
+static void RunServer() {
+ char* server_address = NULL;
+ gpr_join_host_port(&server_address, "::", FLAGS_driver_port);
+
+ WorkerImpl service;
+
+ ServerBuilder builder;
+ builder.AddPort(server_address, InsecureServerCredentials());
+ builder.RegisterService(&service);
+
+ gpr_free(server_address);
+
+ auto server = builder.BuildAndStart();
+
+ while (!got_sigint) {
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ }
+}
+
+} // namespace testing
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ grpc_init();
+ ParseCommandLineFlags(&argc, &argv, true);
+
+ grpc::testing::RunServer();
+
+ grpc_shutdown();
+ return 0;
+}
diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh
index 3760ae4979..520dfcd998 100755
--- a/tools/gce_setup/cloud_prod_runner.sh
+++ b/tools/gce_setup/cloud_prod_runner.sh
@@ -34,7 +34,7 @@ main() {
# temporarily remove ping_pong and cancel_after_first_response while investigating timeout
test_cases=(large_unary empty_unary client_streaming server_streaming cancel_after_begin)
auth_test_cases=(service_account_creds compute_engine_creds)
- clients=(cxx java go ruby node)
+ clients=(cxx java go ruby node csharp_mono)
for test_case in "${test_cases[@]}"
do
for client in "${clients[@]}"
diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh
index 5f8c0e7064..ebc631c1fd 100755
--- a/tools/gce_setup/interop_test_runner.sh
+++ b/tools/gce_setup/interop_test_runner.sh
@@ -35,8 +35,9 @@ echo $result_file_name
main() {
source grpc_docker.sh
- test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming cancel_after_begin cancel_after_first_response)
- clients=(cxx java go ruby node)
+ # temporarily remove ping_pong and cancel_after_first_response while investigating timeout
+ test_cases=(large_unary empty_unary client_streaming server_streaming cancel_after_begin)
+ clients=(cxx java go ruby node csharp_mono)
servers=(cxx java go ruby node python)
for test_case in "${test_cases[@]}"
do
diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh
index c3e88c565d..c85ecf1b25 100755
--- a/tools/run_tests/build_node.sh
+++ b/tools/run_tests/build_node.sh
@@ -36,12 +36,8 @@ CONFIG=${CONFIG:-opt}
# change to grpc repo root
cd $(dirname $0)/../..
-# tells npm install to look for files in that directory
-export GRPC_ROOT=`pwd`
-# tells npm install the subdirectory with library files
-export GRPC_LIB_SUBDIR=libs/$CONFIG
-# tells npm install not to use default locations
-export GRPC_NO_INSTALL=yes
+export CXXFLAGS=-I`pwd`/include
+export LDFLAGS=-L`pwd`/libs/$CONFIG
cd src/node
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index ad65da535b..26caf031c3 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -136,7 +136,7 @@ def which(filename):
class JobSpec(object):
"""Specifies what to run for a job."""
- def __init__(self, cmdline, shortname=None, environ={}, hash_targets=[]):
+ def __init__(self, cmdline, shortname=None, environ=None, hash_targets=None):
"""
Arguments:
cmdline: a list of arguments to pass as the command line
@@ -144,6 +144,10 @@ class JobSpec(object):
hash_targets: which files to include in the hash representing the jobs version
(or empty, indicating the job should not be hashed)
"""
+ if environ is None:
+ environ = {}
+ if hash_targets is None:
+ hash_targets = []
self.cmdline = cmdline
self.environ = environ
self.shortname = cmdline[0] if shortname is None else shortname
diff --git a/tools/run_tests/python_tests.json b/tools/run_tests/python_tests.json
new file mode 100755
index 0000000000..9e5b1365e6
--- /dev/null
+++ b/tools/run_tests/python_tests.json
@@ -0,0 +1,18 @@
+[
+ "grpc._adapter._blocking_invocation_inline_service_test",
+ "grpc._adapter._c_test",
+ "grpc._adapter._event_invocation_synchronous_event_service_test",
+ "grpc._adapter._future_invocation_asynchronous_event_service_test",
+ "grpc._adapter._links_test",
+ "grpc._adapter._lonely_rear_link_test",
+ "grpc._adapter._low_test",
+ "grpc.early_adopter.implementations_test",
+ "grpc.framework.assembly.implementations_test",
+ "grpc.framework.base.packets.implementations_test",
+ "grpc.framework.face.blocking_invocation_inline_service_test",
+ "grpc.framework.face.event_invocation_synchronous_event_service_test",
+ "grpc.framework.face.future_invocation_asynchronous_event_service_test",
+ "grpc.framework.foundation._later_test",
+ "grpc.framework.foundation._logging_pool_test"
+]
+
diff --git a/tools/run_tests/run_node.sh b/tools/run_tests/run_node.sh
index ccf1b9d6f5..3a82c04a8e 100755
--- a/tools/run_tests/run_node.sh
+++ b/tools/run_tests/run_node.sh
@@ -30,9 +30,13 @@
set -ex
+CONFIG=${CONFIG:-opt}
+
# change to grpc repo root
cd $(dirname $0)/../..
root=`pwd`
+export LD_LIBRARY_PATH=$root/libs/$CONFIG
+
$root/src/node/node_modules/mocha/bin/mocha $root/src/node/test
diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh
index 9c7dea008d..403862b0a0 100755
--- a/tools/run_tests/run_python.sh
+++ b/tools/run_tests/run_python.sh
@@ -36,24 +36,4 @@ cd $(dirname $0)/../..
root=`pwd`
export LD_LIBRARY_PATH=$root/libs/opt
source python2.7_virtual_environment/bin/activate
-# TODO(issue 215): Properly itemize these in run_tests.py so that they can be parallelized.
-# TODO(atash): Enable dynamic unused port discovery for this test.
-# TODO(mlumish): Re-enable this test when we can install protoc
-# python2.7 -B test/compiler/python_plugin_test.py --build_mode=opt
-python2.7 -B -m grpc._adapter._blocking_invocation_inline_service_test
-python2.7 -B -m grpc._adapter._c_test
-python2.7 -B -m grpc._adapter._event_invocation_synchronous_event_service_test
-python2.7 -B -m grpc._adapter._future_invocation_asynchronous_event_service_test
-python2.7 -B -m grpc._adapter._links_test
-python2.7 -B -m grpc._adapter._lonely_rear_link_test
-python2.7 -B -m grpc._adapter._low_test
-python2.7 -B -m grpc.early_adopter.implementations_test
-python2.7 -B -m grpc.framework.assembly.implementations_test
-python2.7 -B -m grpc.framework.base.packets.implementations_test
-python2.7 -B -m grpc.framework.face.blocking_invocation_inline_service_test
-python2.7 -B -m grpc.framework.face.event_invocation_synchronous_event_service_test
-python2.7 -B -m grpc.framework.face.future_invocation_asynchronous_event_service_test
-python2.7 -B -m grpc.framework.foundation._later_test
-python2.7 -B -m grpc.framework.foundation._logging_pool_test
-# TODO(nathaniel): Get tests working under 3.4 (requires 3.X-friendly protobuf)
-# python3.4 -B -m unittest discover -s src/python -p '*.py'
+python2.7 -B -m $*
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 23ef475db6..baad727e51 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -51,14 +51,28 @@ os.chdir(ROOT)
# SimpleConfig: just compile with CONFIG=config, and run the binary to test
class SimpleConfig(object):
- def __init__(self, config, environ={}):
+ def __init__(self, config, environ=None):
+ if environ is None:
+ environ = {}
self.build_config = config
self.maxjobs = 2 * multiprocessing.cpu_count()
self.allow_hashing = (config != 'gcov')
self.environ = environ
-
- def job_spec(self, binary, hash_targets):
- return jobset.JobSpec(cmdline=[binary],
+ self.environ['CONFIG'] = config
+
+ def job_spec(self, cmdline, hash_targets):
+ """Construct a jobset.JobSpec for a test under this config
+
+ Args:
+ cmdline: a list of strings specifying the command line the test
+ would like to run
+ hash_targets: either None (don't do caching of test results), or
+ a list of strings specifying files to include in a
+ binary hash to check if a test has changed
+ -- if used, all artifacts needed to run the test must
+ be listed
+ """
+ return jobset.JobSpec(cmdline=cmdline,
environ=self.environ,
hash_targets=hash_targets
if self.allow_hashing else None)
@@ -67,16 +81,18 @@ class SimpleConfig(object):
# ValgrindConfig: compile with some CONFIG=config, but use valgrind to run
class ValgrindConfig(object):
- def __init__(self, config, tool, args=[]):
+ def __init__(self, config, tool, args=None):
+ if args is None:
+ args = []
self.build_config = config
self.tool = tool
self.args = args
self.maxjobs = 2 * multiprocessing.cpu_count()
self.allow_hashing = False
- def job_spec(self, binary, hash_targets):
+ def job_spec(self, cmdline, hash_targets):
return jobset.JobSpec(cmdline=['valgrind', '--tool=%s' % self.tool] +
- self.args + [binary],
+ self.args + cmdline,
shortname='valgrind %s' % binary,
hash_targets=None)
@@ -95,7 +111,7 @@ class CLanguage(object):
if travis and target['flaky']:
continue
binary = 'bins/%s/%s' % (config.build_config, target['name'])
- out.append(config.job_spec(binary, [binary]))
+ out.append(config.job_spec([binary], [binary]))
return out
def make_targets(self):
@@ -104,11 +120,17 @@ class CLanguage(object):
def build_steps(self):
return []
+ def supports_multi_config(self):
+ return True
+
+ def __str__(self):
+ return self.make_target
+
class NodeLanguage(object):
def test_specs(self, config, travis):
- return [config.job_spec('tools/run_tests/run_node.sh', None)]
+ return [config.job_spec(['tools/run_tests/run_node.sh'], None)]
def make_targets(self):
return ['static_c']
@@ -116,11 +138,17 @@ class NodeLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_node.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'node'
+
class PhpLanguage(object):
def test_specs(self, config, travis):
- return [config.job_spec('src/php/bin/run_tests.sh', None)]
+ return [config.job_spec(['src/php/bin/run_tests.sh'], None)]
def make_targets(self):
return ['static_c']
@@ -128,11 +156,22 @@ class PhpLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_php.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'php'
+
class PythonLanguage(object):
+ def __init__(self):
+ with open('tools/run_tests/python_tests.json') as f:
+ self._tests = json.load(f)
+
def test_specs(self, config, travis):
- return [config.job_spec('tools/run_tests/run_python.sh', None)]
+ return [config.job_spec(['tools/run_tests/run_python.sh', test], None)
+ for test in self._tests]
def make_targets(self):
return ['static_c']
@@ -140,10 +179,16 @@ class PythonLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_python.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'python'
+
class RubyLanguage(object):
def test_specs(self, config, travis):
- return [config.job_spec('tools/run_tests/run_ruby.sh', None)]
+ return [config.job_spec(['tools/run_tests/run_ruby.sh'], None)]
def make_targets(self):
return ['static_c']
@@ -151,6 +196,12 @@ class RubyLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_ruby.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'ruby'
+
class CSharpLanguage(object):
def test_specs(self, config, travis):
@@ -162,6 +213,12 @@ class CSharpLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_csharp.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'csharp'
+
# different configurations we can run under
_CONFIGS = {
'dbg': SimpleConfig('dbg'),
@@ -226,6 +283,13 @@ build_configs = set(cfg.build_config for cfg in run_configs)
make_targets = []
languages = set(_LANGUAGES[l] for l in args.language)
+
+if len(build_configs) > 1:
+ for language in languages:
+ if not language.supports_multi_config():
+ print language, 'does not support multiple build configurations'
+ sys.exit(1)
+
build_steps = [jobset.JobSpec(['make',
'-j', '%d' % (multiprocessing.cpu_count() + 1),
'EXTRA_DEFINES=GRPC_TEST_SLOWDOWN_MACHINE_FACTOR=%f' % args.slowdown,
@@ -233,7 +297,8 @@ build_steps = [jobset.JobSpec(['make',
itertools.chain.from_iterable(
l.make_targets() for l in languages))))
for cfg in build_configs] + list(set(
- jobset.JobSpec(cmdline)
+ jobset.JobSpec(cmdline, environ={'CONFIG': cfg})
+ for cfg in build_configs
for l in languages
for cmdline in l.build_steps()))
one_run = set(