diff options
author | 2017-12-06 22:02:08 -0800 | |
---|---|---|
committer | 2017-12-06 22:02:08 -0800 | |
commit | fc38142db69cd8c95f3c55a296b4e73b04c720c3 (patch) | |
tree | 8287e97154a1edcd764585623aa6cda08439159b /test/cpp/microbenchmarks | |
parent | a4839e7aea1bd1ae057584a5cdf125541ef11016 (diff) | |
parent | e52772451a7bbf4f3f7b72cfc369781fd74a6930 (diff) |
Merge commit 'b0bad8f^' into fix-stream-compression-config-interface
Diffstat (limited to 'test/cpp/microbenchmarks')
-rw-r--r-- | test/cpp/microbenchmarks/bm_arena.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_call_create.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 4 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_closure.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_cq.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_cq_multiple_threads.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_error.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_metadata.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/bm_pollset.cc | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/fullstack_fixtures.h | 2 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h | 47 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/helpers.h | 2 |
12 files changed, 30 insertions, 41 deletions
diff --git a/test/cpp/microbenchmarks/bm_arena.cc b/test/cpp/microbenchmarks/bm_arena.cc index 165b74670d..5b7c611919 100644 --- a/test/cpp/microbenchmarks/bm_arena.cc +++ b/test/cpp/microbenchmarks/bm_arena.cc @@ -18,9 +18,7 @@ /* Benchmark arenas */ -extern "C" { #include "src/core/lib/support/arena.h" -} #include "test/cpp/microbenchmarks/helpers.h" #include "third_party/benchmark/include/benchmark/benchmark.h" diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 1c625c75c4..ec5c1275d1 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -29,7 +29,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> -extern "C" { #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/deadline/deadline_filter.h" #include "src/core/ext/filters/http/client/http_client_filter.h" @@ -43,7 +42,6 @@ extern "C" { #include "src/core/lib/profiling/timers.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/transport/transport_impl.h" -} #include "src/cpp/client/create_channel_internal.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index f8c31910fe..45f5382fde 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -22,14 +22,14 @@ #include <grpc/support/log.h> #include <string.h> #include <sstream> -extern "C" { + #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/timeout_encoding.h" -} + #include "test/cpp/microbenchmarks/helpers.h" #include "third_party/benchmark/include/benchmark/benchmark.h" diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index d600ce77d9..458a2ceb13 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -22,12 +22,10 @@ #include <grpc/grpc.h> #include <sstream> -extern "C" { #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/support/spinlock.h" -} #include "test/cpp/microbenchmarks/helpers.h" diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 020ec0461c..dac702b08b 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -26,9 +26,7 @@ #include <grpc/support/log.h> #include "test/cpp/microbenchmarks/helpers.h" -extern "C" { #include "src/core/lib/surface/completion_queue.h" -} namespace grpc { namespace testing { diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 57a69acf01..8d4349a297 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -25,11 +25,9 @@ #include <grpc/support/log.h> #include "test/cpp/microbenchmarks/helpers.h" -extern "C" { #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" #include "src/core/lib/surface/completion_queue.h" -} struct grpc_pollset { gpr_mu mu; diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc index 56b80dfcf6..aa7822653f 100644 --- a/test/cpp/microbenchmarks/bm_error.cc +++ b/test/cpp/microbenchmarks/bm_error.cc @@ -21,10 +21,8 @@ #include <benchmark/benchmark.h> #include <memory> -extern "C" { #include "src/core/lib/iomgr/error.h" #include "src/core/lib/transport/error_utils.h" -} #include "test/cpp/microbenchmarks/helpers.h" diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc index 360bbabe13..1ed05f7466 100644 --- a/test/cpp/microbenchmarks/bm_metadata.cc +++ b/test/cpp/microbenchmarks/bm_metadata.cc @@ -21,10 +21,8 @@ #include <benchmark/benchmark.h> #include <grpc/grpc.h> -extern "C" { #include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/static_metadata.h" -} #include "test/cpp/microbenchmarks/helpers.h" diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc index eab1e89480..92d76f307e 100644 --- a/test/cpp/microbenchmarks/bm_pollset.cc +++ b/test/cpp/microbenchmarks/bm_pollset.cc @@ -23,12 +23,10 @@ #include <grpc/support/log.h> #include <grpc/support/useful.h> -extern "C" { #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/port.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" -} #include "test/cpp/microbenchmarks/helpers.h" #include "third_party/benchmark/include/benchmark/benchmark.h" diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index 9d345a909b..71bbb393db 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -28,7 +28,6 @@ #include <grpc/support/atm.h> #include <grpc/support/log.h> -extern "C" { #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/endpoint.h" @@ -40,7 +39,6 @@ extern "C" { #include "src/core/lib/surface/server.h" #include "test/core/util/passthru_endpoint.h" #include "test/core/util/port.h" -} #include "src/cpp/client/create_channel_internal.h" #include "test/cpp/microbenchmarks/helpers.h" diff --git a/test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h b/test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h index 6df044f344..0763d07855 100644 --- a/test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h +++ b/test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h @@ -278,7 +278,7 @@ static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) { void* t; bool ok; - int need_tags; + int expect_tags = 0; // Send 'max_ping_pongs' number of ping pong messages int ping_pong_cnt = 0; @@ -289,7 +289,7 @@ static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) { request_rw->Write(send_request, tag(2)); // Start client send } - need_tags = (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5); + int await_tags = (1 << 2); if (ping_pong_cnt == 0) { // wait for the server call structure (call_hook, etc.) to be @@ -301,8 +301,8 @@ static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) { // In some cases tag:2 comes before tag:0 (write tag comes out // first), this while loop is to make sure get tag:0. int i = (int)(intptr_t)t; - GPR_ASSERT(need_tags & (1 << i)); - need_tags &= ~(1 << i); + GPR_ASSERT(await_tags & (1 << i)); + await_tags &= ~(1 << i); GPR_ASSERT(fixture->cq()->Next(&t, &ok)); } } @@ -310,7 +310,11 @@ static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) { response_rw.Read(&recv_request, tag(3)); // Start server recv request_rw->Read(&recv_response, tag(4)); // Start client recv - while (need_tags) { + await_tags |= (1 << 3) | (1 << 4); + expect_tags = await_tags; + await_tags |= (1 << 5); + + while (await_tags != 0) { GPR_ASSERT(fixture->cq()->Next(&t, &ok)); GPR_ASSERT(ok); int i = (int)(intptr_t)t; @@ -321,34 +325,39 @@ static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) { if (write_and_finish == 1) { response_rw.WriteAndFinish(send_response, WriteOptions(), Status::OK, tag(5)); + expect_tags |= (1 << 5); } else { response_rw.WriteLast(send_response, WriteOptions(), tag(5)); - // WriteLast buffers the write, so neither server write op nor - // client read op will finish inside the while loop. - need_tags &= ~(1 << 4); - need_tags &= ~(1 << 5); + // WriteLast buffers the write, so it's possible neither server + // write op nor client read op will finish inside the while + // loop. + await_tags &= ~(1 << 4); + await_tags &= ~(1 << 5); + expect_tags |= (1 << 5); } } else { response_rw.Write(send_response, tag(5)); + expect_tags |= (1 << 5); } } - GPR_ASSERT(need_tags & (1 << i)); - need_tags &= ~(1 << i); + GPR_ASSERT(expect_tags & (1 << i)); + expect_tags &= ~(1 << i); + await_tags &= ~(1 << i); } ping_pong_cnt++; } if (max_ping_pongs == 0) { - need_tags = (1 << 6) | (1 << 7) | (1 << 8); + expect_tags |= (1 << 6) | (1 << 7) | (1 << 8); } else { if (write_and_finish == 1) { - need_tags = (1 << 8); + expect_tags |= (1 << 8); } else { // server's buffered write and the client's read of the buffered write // tags should come up. - need_tags = (1 << 4) | (1 << 5) | (1 << 7) | (1 << 8); + expect_tags |= (1 << 7) | (1 << 8); } } @@ -360,8 +369,8 @@ static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) { GPR_ASSERT(fixture->cq()->Next(&t, &ok)); while ((int)(intptr_t)t != 0) { int i = (int)(intptr_t)t; - GPR_ASSERT(need_tags & (1 << i)); - need_tags &= ~(1 << i); + GPR_ASSERT(expect_tags & (1 << i)); + expect_tags &= ~(1 << i); GPR_ASSERT(fixture->cq()->Next(&t, &ok)); } response_rw.Finish(Status::OK, tag(7)); @@ -374,11 +383,11 @@ static void BM_StreamingPingPongWithCoalescingApi(benchmark::State& state) { Status recv_status; request_rw->Finish(&recv_status, tag(8)); - while (need_tags) { + while (expect_tags) { GPR_ASSERT(fixture->cq()->Next(&t, &ok)); int i = (int)(intptr_t)t; - GPR_ASSERT(need_tags & (1 << i)); - need_tags &= ~(1 << i); + GPR_ASSERT(expect_tags & (1 << i)); + expect_tags &= ~(1 << i); } GPR_ASSERT(recv_status.ok()); diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h index b6cea7c317..07be589df6 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -22,11 +22,9 @@ #include <sstream> #include <vector> -extern "C" { #include <grpc/support/port_platform.h> #include "src/core/lib/debug/stats.h" #include "test/core/util/memory_counters.h" -} #include <benchmark/benchmark.h> #include <grpc++/impl/grpc_library.h> |