Add copyright

pull/18881/head
Na-Na Pang 6 years ago
parent 13d6d7c2ec
commit 8bf138d799
  1. 18
      test/cpp/microbenchmarks/bm_callback_streaming_ping_pong.cc
  2. 27
      test/cpp/microbenchmarks/bm_callback_unary_ping_pong.cc
  3. 25
      test/cpp/microbenchmarks/callback_streaming_ping_pong.h
  4. 27
      test/cpp/microbenchmarks/callback_test_service.cc
  5. 33
      test/cpp/microbenchmarks/callback_test_service.h
  6. 7
      test/cpp/microbenchmarks/callback_unary_ping_pong.h

@ -1,3 +1,21 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "test/cpp/microbenchmarks/callback_streaming_ping_pong.h"
#include "test/cpp/util/test_config.h"

@ -1,3 +1,21 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "test/cpp/microbenchmarks/callback_unary_ping_pong.h"
#include "test/cpp/util/test_config.h"
@ -22,11 +40,14 @@ static void SweepSizesArgs(benchmark::internal::Benchmark* b) {
}
}
BENCHMARK_TEMPLATE(BM_CallbackUnaryPingPong, InProcess, NoOpMutator, NoOpMutator)
BENCHMARK_TEMPLATE(BM_CallbackUnaryPingPong, InProcess, NoOpMutator,
NoOpMutator)
->Apply(SweepSizesArgs);
BENCHMARK_TEMPLATE(BM_CallbackUnaryPingPong, MinInProcess, NoOpMutator, NoOpMutator)
BENCHMARK_TEMPLATE(BM_CallbackUnaryPingPong, MinInProcess, NoOpMutator,
NoOpMutator)
->Apply(SweepSizesArgs);
BENCHMARK_TEMPLATE(BM_CallbackUnaryPingPong, InProcessCHTTP2, NoOpMutator, NoOpMutator)
BENCHMARK_TEMPLATE(BM_CallbackUnaryPingPong, InProcessCHTTP2, NoOpMutator,
NoOpMutator)
->Apply(SweepSizesArgs);
BENCHMARK_TEMPLATE(BM_CallbackUnaryPingPong, MinInProcessCHTTP2, NoOpMutator,
NoOpMutator)

@ -1,14 +1,31 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef TEST_CPP_MICROBENCHMARKS_CALLBACK_STREAMING_PING_PONG_H
#define TEST_CPP_MICROBENCHMARKS_CALLBACK_STREAMING_PING_PONG_H
#include <benchmark/benchmark.h>
#include <sstream>
#include "src/core/lib/profiling/timers.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/microbenchmarks/callback_test_service.h"
#include "test/cpp/microbenchmarks/fullstack_context_mutators.h"
#include "test/cpp/microbenchmarks/fullstack_fixtures.h"
#include "test/cpp/microbenchmarks/callback_test_service.h"
namespace grpc {
namespace testing {
@ -44,8 +61,8 @@ static void BM_CallbackBidiStreaming(benchmark::State& state) {
}
fixture->Finish(state);
fixture.reset();
state.SetBytesProcessed(2 * state.range(0) * state.iterations()
* state.range(1));
state.SetBytesProcessed(2 * state.range(0) * state.iterations() *
state.range(1));
}
} // namespace testing

@ -1,3 +1,21 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "test/cpp/microbenchmarks/callback_test_service.h"
namespace grpc {
@ -36,16 +54,16 @@ void CallbackStreamingTestService::Echo(
experimental::ServerBidiReactor<EchoRequest, EchoResponse>*
CallbackStreamingTestService::BidiStream() {
class Reactor : public experimental::ServerBidiReactor<EchoRequest,
EchoResponse> {
class Reactor
: public experimental::ServerBidiReactor<EchoRequest, EchoResponse> {
public:
Reactor() {}
void OnStarted(ServerContext* context) override {
ctx_ = context;
server_write_last_ = GetIntValueFromMetadata(
kServerFinishAfterNReads, context->client_metadata(), 0);
message_size_ = GetIntValueFromMetadata(
kServerResponseStreamsToSend, context->client_metadata(), 0);
message_size_ = GetIntValueFromMetadata(kServerResponseStreamsToSend,
context->client_metadata(), 0);
// EchoRequest* request = new EchoRequest;
// if (message_size_ > 0) {
// request->set_message(std::string(message_size_, 'a'));
@ -108,4 +126,3 @@ CallbackStreamingTestService::BidiStream() {
}
} // namespace testing
} // namespace grpc

@ -1,12 +1,30 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef TEST_CPP_MICROBENCHMARKS_CALLBACK_TEST_SERVICE_H
#define TEST_CPP_MICROBENCHMARKS_CALLBACK_TEST_SERVICE_H
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/util/string_ref_helper.h"
#include <sstream>
#include <condition_variable>
#include <memory>
#include <mutex>
#include <condition_variable>
#include <sstream>
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/util/string_ref_helper.h"
namespace grpc {
namespace testing {
@ -22,14 +40,16 @@ class CallbackStreamingTestService
EchoResponse* response,
experimental::ServerCallbackRpcController* controller) override;
experimental::ServerBidiReactor<EchoRequest, EchoResponse>* BidiStream() override;
experimental::ServerBidiReactor<EchoRequest, EchoResponse>* BidiStream()
override;
};
class BidiClient
: public grpc::experimental::ClientBidiReactor<EchoRequest, EchoResponse> {
public:
BidiClient(EchoTestService::Stub* stub, EchoRequest* request,
EchoResponse* response, ClientContext* context, int num_msgs_to_send)
EchoResponse* response, ClientContext* context,
int num_msgs_to_send)
: request_{request},
response_{response},
context_{context},
@ -89,7 +109,6 @@ class BidiClient
bool done_ = false;
};
} // namespace testing
} // namespace grpc
#endif // TEST_CPP_MICROBENCHMARKS_CALLBACK_TEST_SERVICE_H

@ -1,6 +1,6 @@
/*
*
* Copyright 2016 gRPC authors.
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,9 +25,9 @@
#include <sstream>
#include "src/core/lib/profiling/timers.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/microbenchmarks/callback_test_service.h"
#include "test/cpp/microbenchmarks/fullstack_context_mutators.h"
#include "test/cpp/microbenchmarks/fullstack_fixtures.h"
#include "test/cpp/microbenchmarks/callback_test_service.h"
namespace grpc {
namespace testing {
@ -76,7 +76,8 @@ static void BM_CallbackUnaryPingPong(benchmark::State& state) {
}
fixture->Finish(state);
fixture.reset();
state.SetBytesProcessed(state.range(0) * state.iterations() + state.range(1) * state.iterations());
state.SetBytesProcessed(state.range(0) * state.iterations() +
state.range(1) * state.iterations());
}
} // namespace testing
} // namespace grpc

Loading…
Cancel
Save