From 922260656a288d302016d044ff1572be5dc61b8c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sun, 8 Oct 2017 21:16:12 -0700 Subject: C++ize BDP estimator, introduce ManualConstructor --- gRPC-Core.podspec | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gRPC-Core.podspec') diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index f19b672f5a..ce1425a483 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -191,6 +191,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/atomic_with_atm.h', 'src/core/lib/support/atomic_with_std.h', 'src/core/lib/support/env.h', + 'src/core/lib/support/manual_constructor.h', 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', @@ -736,6 +737,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/atomic_with_atm.h', 'src/core/lib/support/atomic_with_std.h', 'src/core/lib/support/env.h', + 'src/core/lib/support/manual_constructor.h', 'src/core/lib/support/memory.h', 'src/core/lib/support/mpscq.h', 'src/core/lib/support/murmur_hash.h', -- cgit v1.2.3 From 6f2b5f0d2227b35f5e017a99e255451b73efb8f0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Oct 2017 08:20:03 -0700 Subject: Fix sanity --- build.yaml | 1 + gRPC-Core.podspec | 2 ++ grpc.gemspec | 1 + package.xml | 1 + tools/doxygen/Doxyfile.c++.internal | 1 + tools/doxygen/Doxyfile.core.internal | 1 + tools/run_tests/generated/sources_and_headers.json | 2 ++ 7 files changed, 9 insertions(+) (limited to 'gRPC-Core.podspec') diff --git a/build.yaml b/build.yaml index b2d89b30d9..aa66f94491 100644 --- a/build.yaml +++ b/build.yaml @@ -426,6 +426,7 @@ filegroups: - src/core/lib/slice/slice_hash_table.h - src/core/lib/slice/slice_internal.h - src/core/lib/slice/slice_string_helpers.h + - src/core/lib/support/vector.h - src/core/lib/surface/alarm_internal.h - src/core/lib/surface/api_trace.h - src/core/lib/surface/call.h diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 7ad6812a89..f005ab8fd3 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -397,6 +397,7 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_hash_table.h', 'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_string_helpers.h', + 'src/core/lib/support/vector.h', 'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/api_trace.h', 'src/core/lib/surface/call.h', @@ -896,6 +897,7 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_hash_table.h', 'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_string_helpers.h', + 'src/core/lib/support/vector.h', 'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/api_trace.h', 'src/core/lib/surface/call.h', diff --git a/grpc.gemspec b/grpc.gemspec index c37859f3d1..934a5f1de0 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -341,6 +341,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/slice/slice_hash_table.h ) s.files += %w( src/core/lib/slice/slice_internal.h ) s.files += %w( src/core/lib/slice/slice_string_helpers.h ) + s.files += %w( src/core/lib/support/vector.h ) s.files += %w( src/core/lib/surface/alarm_internal.h ) s.files += %w( src/core/lib/surface/api_trace.h ) s.files += %w( src/core/lib/surface/call.h ) diff --git a/package.xml b/package.xml index 36206890f1..e203faf01f 100644 --- a/package.xml +++ b/package.xml @@ -353,6 +353,7 @@ + diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 584dd0af57..7eff00604f 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1040,6 +1040,7 @@ src/core/lib/support/string.h \ src/core/lib/support/string_windows.h \ src/core/lib/support/time_precise.h \ src/core/lib/support/tmpfile.h \ +src/core/lib/support/vector.h \ src/core/lib/surface/alarm_internal.h \ src/core/lib/surface/api_trace.h \ src/core/lib/surface/call.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index ee593e3ea0..52d67f4e11 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1352,6 +1352,7 @@ src/core/lib/support/tmpfile.h \ src/core/lib/support/tmpfile_msys.cc \ src/core/lib/support/tmpfile_posix.cc \ src/core/lib/support/tmpfile_windows.cc \ +src/core/lib/support/vector.h \ src/core/lib/support/wrap_memcpy.cc \ src/core/lib/surface/README.md \ src/core/lib/surface/alarm.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 242910544a..c9ea74aa93 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8258,6 +8258,7 @@ "src/core/lib/slice/slice_hash_table.h", "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", + "src/core/lib/support/vector.h", "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", "src/core/lib/surface/call.h", @@ -8391,6 +8392,7 @@ "src/core/lib/slice/slice_hash_table.h", "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", + "src/core/lib/support/vector.h", "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", "src/core/lib/surface/call.h", -- cgit v1.2.3 From 3273648a87a34a166f7ef83955a9700f2c9dd45e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Oct 2017 22:02:28 -0700 Subject: flow control fixes --- BUILD | 1 + build.yaml | 1 + gRPC-Core.podspec | 2 ++ grpc.gemspec | 1 + package.xml | 1 + .../ext/transport/chttp2/transport/flow_control.h | 11 +++++++ test/core/end2end/bad_server_response_test.c | 8 ++--- test/core/end2end/tests/shutdown_finishes_calls.c | 3 +- test/cpp/microbenchmarks/bm_chttp2_transport.cc | 36 ++++++++++------------ tools/doxygen/Doxyfile.core.internal | 1 + tools/run_tests/generated/sources_and_headers.json | 2 ++ 11 files changed, 43 insertions(+), 24 deletions(-) (limited to 'gRPC-Core.podspec') diff --git a/BUILD b/BUILD index d8bb109492..a3299f4eef 100644 --- a/BUILD +++ b/BUILD @@ -1259,6 +1259,7 @@ grpc_cc_library( "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", "src/core/ext/transport/chttp2/transport/frame.h", + "src/core/ext/transport/chttp2/transport/flow_control.h", "src/core/ext/transport/chttp2/transport/frame_data.h", "src/core/ext/transport/chttp2/transport/frame_goaway.h", "src/core/ext/transport/chttp2/transport/frame_ping.h", diff --git a/build.yaml b/build.yaml index 78b18ff35a..e5e0757855 100644 --- a/build.yaml +++ b/build.yaml @@ -777,6 +777,7 @@ filegroups: - src/core/ext/transport/chttp2/transport/bin_decoder.h - src/core/ext/transport/chttp2/transport/bin_encoder.h - src/core/ext/transport/chttp2/transport/chttp2_transport.h + - src/core/ext/transport/chttp2/transport/flow_control.h - src/core/ext/transport/chttp2/transport/frame.h - src/core/ext/transport/chttp2/transport/frame_data.h - src/core/ext/transport/chttp2/transport/frame_goaway.h diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index ce1425a483..74f3e5b7d0 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -249,6 +249,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/bin_decoder.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', + 'src/core/ext/transport/chttp2/transport/flow_control.h', 'src/core/ext/transport/chttp2/transport/frame.h', 'src/core/ext/transport/chttp2/transport/frame_data.h', 'src/core/ext/transport/chttp2/transport/frame_goaway.h', @@ -750,6 +751,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/bin_decoder.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', + 'src/core/ext/transport/chttp2/transport/flow_control.h', 'src/core/ext/transport/chttp2/transport/frame.h', 'src/core/ext/transport/chttp2/transport/frame_data.h', 'src/core/ext/transport/chttp2/transport/frame_goaway.h', diff --git a/grpc.gemspec b/grpc.gemspec index ab51cc8420..6d7235028d 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -181,6 +181,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/bin_decoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h ) + s.files += %w( src/core/ext/transport/chttp2/transport/flow_control.h ) s.files += %w( src/core/ext/transport/chttp2/transport/frame.h ) s.files += %w( src/core/ext/transport/chttp2/transport/frame_data.h ) s.files += %w( src/core/ext/transport/chttp2/transport/frame_goaway.h ) diff --git a/package.xml b/package.xml index e590745a67..0c5b1918b5 100644 --- a/package.xml +++ b/package.xml @@ -193,6 +193,7 @@ + diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h index 13a3341122..33542a31e4 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.h +++ b/src/core/ext/transport/chttp2/transport/flow_control.h @@ -201,6 +201,11 @@ class TransportFlowControl { FlowControlAction PeriodicUpdate(grpc_exec_ctx* exec_ctx); + void TestOnlyForceHugeWindow() { + announced_window_ = 1024 * 1024 * 1024; + remote_window_ = 1024 * 1024 * 1024; + } + private: double SmoothLogBdp(grpc_exec_ctx* exec_ctx, double value); FlowControlAction::Urgency DeltaUrgency(int32_t value, @@ -289,6 +294,12 @@ class StreamFlowControl { const grpc_chttp2_stream* stream() const { return s_; } + void TestOnlyForceHugeWindow() { + announced_window_delta_ = 1024 * 1024 * 1024; + local_window_delta_ = 1024 * 1024 * 1024; + remote_window_delta_ = 1024 * 1024 * 1024; + } + private: TransportFlowControl* const tfc_; const grpc_chttp2_stream* const s_; diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index 554d8aa45b..2070fa5b02 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -207,8 +207,8 @@ static void start_rpc(int target_port, grpc_status_code expected_status, GPR_ASSERT(status == expected_status); if (expected_detail != NULL) { - GPR_ASSERT(-1 != grpc_slice_slice(details, grpc_slice_from_static_string( - expected_detail))); + GPR_ASSERT(-1 != grpc_slice_slice(details, grpc_slice_from_static_string( + expected_detail))); } grpc_metadata_array_destroy(&initial_metadata_recv); @@ -330,8 +330,8 @@ int main(int argc, char **argv) { HTTP2_DETAIL_MSG(502)); /* unparseable response */ - run_test(UNPARSEABLE_RESP, sizeof(UNPARSEABLE_RESP) - 1, - GRPC_STATUS_UNKNOWN, NULL); + run_test(UNPARSEABLE_RESP, sizeof(UNPARSEABLE_RESP) - 1, GRPC_STATUS_UNKNOWN, + NULL); /* http1 response */ run_test(HTTP1_RESP, sizeof(HTTP1_RESP) - 1, GRPC_STATUS_UNAVAILABLE, diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index 652695cfcd..1312a2dd68 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -159,7 +159,8 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_server_destroy(f.server); - GPR_ASSERT(status == GRPC_STATUS_INTERNAL || status == GRPC_STATUS_UNAVAILABLE); + GPR_ASSERT(status == GRPC_STATUS_INTERNAL || + status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); validate_host_override_string("foo.test.google.fr:1234", call_details.host, config); diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 8ee3ae7268..3a484bb790 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -428,9 +428,8 @@ static void BM_TransportStreamSend(benchmark::State &state) { return; } // force outgoing window to be yuge - s->chttp2_stream()->flow_control.remote_window_delta = - 1024 * 1024 * 1024; - f.chttp2_transport()->flow_control.remote_window = 1024 * 1024 * 1024; + s->chttp2_stream()->flow_control->TestOnlyForceHugeWindow(); + f.chttp2_transport()->flow_control->TestOnlyForceHugeWindow(); grpc_slice_buffer_stream_init(&send_stream, &send_buffer, 0); reset_op(); op.on_complete = c.get(); @@ -560,22 +559,21 @@ static void BM_TransportStreamRecv(benchmark::State &state) { std::unique_ptr drain_continue; grpc_slice recv_slice; - std::unique_ptr c = MakeClosure([&](grpc_exec_ctx *exec_ctx, - grpc_error *error) { - if (!state.KeepRunning()) return; - // force outgoing window to be yuge - s.chttp2_stream()->flow_control.local_window_delta = 1024 * 1024 * 1024; - s.chttp2_stream()->flow_control.announced_window_delta = 1024 * 1024 * 1024; - f.chttp2_transport()->flow_control.announced_window = 1024 * 1024 * 1024; - received = 0; - reset_op(); - op.on_complete = do_nothing.get(); - op.recv_message = true; - op.payload->recv_message.recv_message = &recv_stream; - op.payload->recv_message.recv_message_ready = drain_start.get(); - s.Op(exec_ctx, &op); - f.PushInput(grpc_slice_ref(incoming_data)); - }); + std::unique_ptr c = + MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { + if (!state.KeepRunning()) return; + // force outgoing window to be yuge + s.chttp2_stream()->flow_control->TestOnlyForceHugeWindow(); + f.chttp2_transport()->flow_control->TestOnlyForceHugeWindow(); + received = 0; + reset_op(); + op.on_complete = do_nothing.get(); + op.recv_message = true; + op.payload->recv_message.recv_message = &recv_stream; + op.payload->recv_message.recv_message_ready = drain_start.get(); + s.Op(exec_ctx, &op); + f.PushInput(grpc_slice_ref(incoming_data)); + }); drain_start = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { if (recv_stream == NULL) { diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 8435178d2e..87dadb39b8 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1020,6 +1020,7 @@ src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.cc \ src/core/ext/transport/chttp2/transport/chttp2_transport.h \ src/core/ext/transport/chttp2/transport/flow_control.cc \ +src/core/ext/transport/chttp2/transport/flow_control.h \ src/core/ext/transport/chttp2/transport/frame.h \ src/core/ext/transport/chttp2/transport/frame_data.cc \ src/core/ext/transport/chttp2/transport/frame_data.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 82b3800507..ffd2de9949 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -9007,6 +9007,7 @@ "src/core/ext/transport/chttp2/transport/bin_decoder.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", + "src/core/ext/transport/chttp2/transport/flow_control.h", "src/core/ext/transport/chttp2/transport/frame.h", "src/core/ext/transport/chttp2/transport/frame_data.h", "src/core/ext/transport/chttp2/transport/frame_goaway.h", @@ -9036,6 +9037,7 @@ "src/core/ext/transport/chttp2/transport/chttp2_transport.cc", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", "src/core/ext/transport/chttp2/transport/flow_control.cc", + "src/core/ext/transport/chttp2/transport/flow_control.h", "src/core/ext/transport/chttp2/transport/frame.h", "src/core/ext/transport/chttp2/transport/frame_data.cc", "src/core/ext/transport/chttp2/transport/frame_data.h", -- cgit v1.2.3