aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2018-01-31 23:21:41 +0100
committerGravatar Jan Tattermusch <jtattermusch@google.com>2018-01-31 23:21:41 +0100
commit889bb7fde4c3f8f36c3821e16b0b66870e68526d (patch)
tree93e408ff395458ccad6af857b7481ef725aafdb6 /test/cpp
parent18f27376c531e857d8fb946d758c81880023ed42 (diff)
calling create in default param is against code style
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/microbenchmarks/bm_fullstack_trickle.cc9
-rw-r--r--test/cpp/microbenchmarks/fullstack_fixtures.h26
-rw-r--r--test/cpp/performance/writes_per_rpc_test.cc6
3 files changed, 27 insertions, 14 deletions
diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
index 3e31c2a4cb..294f1feb80 100644
--- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
+++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc
@@ -80,8 +80,7 @@ class TrickledCHTTP2 : public EndpointPairFixture {
public:
TrickledCHTTP2(Service* service, bool streaming, size_t req_size,
size_t resp_size, size_t kilobits_per_second,
- grpc_passthru_endpoint_stats* stats =
- grpc_passthru_endpoint_stats_create())
+ grpc_passthru_endpoint_stats* stats)
: EndpointPairFixture(service, MakeEndpoints(kilobits_per_second, stats),
FixtureConfiguration()),
stats_(stats) {
@@ -261,7 +260,8 @@ static void BM_PumpStreamServerToClient_Trickle(benchmark::State& state) {
EchoTestService::AsyncService service;
std::unique_ptr<TrickledCHTTP2> fixture(new TrickledCHTTP2(
&service, true, state.range(0) /* req_size */,
- state.range(0) /* resp_size */, state.range(1) /* bw in kbit/s */));
+ state.range(0) /* resp_size */, state.range(1) /* bw in kbit/s */,
+ grpc_passthru_endpoint_stats_create()));
{
EchoResponse send_response;
EchoResponse recv_response;
@@ -354,7 +354,8 @@ static void BM_PumpUnbalancedUnary_Trickle(benchmark::State& state) {
EchoTestService::AsyncService service;
std::unique_ptr<TrickledCHTTP2> fixture(new TrickledCHTTP2(
&service, false, state.range(0) /* req_size */,
- state.range(1) /* resp_size */, state.range(2) /* bw in kbit/s */));
+ state.range(1) /* resp_size */, state.range(2) /* bw in kbit/s */,
+ grpc_passthru_endpoint_stats_create()));
EchoRequest send_request;
EchoResponse send_response;
EchoResponse recv_response;
diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h
index 00ec72deee..d73caa01c8 100644
--- a/test/cpp/microbenchmarks/fullstack_fixtures.h
+++ b/test/cpp/microbenchmarks/fullstack_fixtures.h
@@ -245,18 +245,20 @@ class SockPair : public EndpointPairFixture {
fixture_configuration) {}
};
-class InProcessCHTTP2 : public EndpointPairFixture {
+/* Use InProcessCHTTP2 instead. This class (with stats as an explicit parameter)
+ is here only to be able to initialize both the base class and stats_ with the
+ same stats instance without accessing the stats_ fields before the object is
+ properly initialized. */
+class InProcessCHTTP2WithExplicitStats : public EndpointPairFixture {
public:
- InProcessCHTTP2(Service* service,
- const FixtureConfiguration& fixture_configuration =
- FixtureConfiguration(),
- grpc_passthru_endpoint_stats* stats =
- grpc_passthru_endpoint_stats_create())
+ InProcessCHTTP2WithExplicitStats(
+ Service* service, grpc_passthru_endpoint_stats* stats,
+ const FixtureConfiguration& fixture_configuration)
: EndpointPairFixture(service, MakeEndpoints(stats),
fixture_configuration),
stats_(stats) {}
- virtual ~InProcessCHTTP2() {
+ virtual ~InProcessCHTTP2WithExplicitStats() {
if (stats_ != nullptr) {
grpc_passthru_endpoint_stats_destroy(stats_);
}
@@ -280,6 +282,16 @@ class InProcessCHTTP2 : public EndpointPairFixture {
}
};
+class InProcessCHTTP2 : public InProcessCHTTP2WithExplicitStats {
+ public:
+ InProcessCHTTP2(Service* service,
+ const FixtureConfiguration& fixture_configuration =
+ FixtureConfiguration())
+ : InProcessCHTTP2WithExplicitStats(service,
+ grpc_passthru_endpoint_stats_create(),
+ fixture_configuration) {}
+};
+
////////////////////////////////////////////////////////////////////////////////
// Minimal stack fixtures
diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc
index 86e3bbcd4e..b7d951a86e 100644
--- a/test/cpp/performance/writes_per_rpc_test.cc
+++ b/test/cpp/performance/writes_per_rpc_test.cc
@@ -142,8 +142,7 @@ class EndpointPairFixture {
class InProcessCHTTP2 : public EndpointPairFixture {
public:
- InProcessCHTTP2(Service* service, grpc_passthru_endpoint_stats* stats =
- grpc_passthru_endpoint_stats_create())
+ InProcessCHTTP2(Service* service, grpc_passthru_endpoint_stats* stats)
: EndpointPairFixture(service, MakeEndpoints(stats)), stats_(stats) {}
virtual ~InProcessCHTTP2() {
@@ -169,7 +168,8 @@ static double UnaryPingPong(int request_size, int response_size) {
const int kIterations = 10000;
EchoTestService::AsyncService service;
- std::unique_ptr<InProcessCHTTP2> fixture(new InProcessCHTTP2(&service));
+ std::unique_ptr<InProcessCHTTP2> fixture(
+ new InProcessCHTTP2(&service, grpc_passthru_endpoint_stats_create()));
EchoRequest send_request;
EchoResponse send_response;
EchoResponse recv_response;