aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-05-01 11:34:45 -0700
committerGravatar Yang Gao <yangg@google.com>2015-05-01 11:34:45 -0700
commitea13af73e09cbf2c212069a17b700f6aa121f280 (patch)
treeaaf81371e9394ce08b1d80ee574501354f2cd6ee /src/cpp
parent3921c56bee2adff62cb0f9519114d2aa22a67410 (diff)
parent87344c88d535c0cb080d75dc925af369035c87e3 (diff)
merge with head
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/client/channel.cc6
-rw-r--r--src/cpp/common/call.cc8
-rw-r--r--src/cpp/common/completion_queue.cc2
-rw-r--r--src/cpp/proto/proto_utils.cc1
-rw-r--r--src/cpp/server/server.cc8
5 files changed, 13 insertions, 12 deletions
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index c541ddfb48..475a20d883 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -70,7 +70,7 @@ Call Channel::CreateCall(const RpcMethod& method, ClientContext* context,
? target_.c_str()
: context->authority().c_str(),
context->raw_deadline());
- GRPC_TIMER_MARK(CALL_CREATED, c_call);
+ GRPC_TIMER_MARK(GRPC_PTAG_CPP_CALL_CREATED, c_call);
context->set_call(c_call, shared_from_this());
return Call(c_call, this, cq);
}
@@ -79,11 +79,11 @@ void Channel::PerformOpsOnCall(CallOpBuffer* buf, Call* call) {
static const size_t MAX_OPS = 8;
size_t nops = MAX_OPS;
grpc_op ops[MAX_OPS];
- GRPC_TIMER_MARK(PERFORM_OPS_BEGIN, call->call());
+ GRPC_TIMER_BEGIN(GRPC_PTAG_CPP_PERFORM_OPS, call->call());
buf->FillOps(ops, &nops);
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(call->call(), ops, nops, buf));
- GRPC_TIMER_MARK(PERFORM_OPS_END, call->call());
+ GRPC_TIMER_END(GRPC_PTAG_CPP_PERFORM_OPS, call->call());
}
void* Channel::RegisterMethod(const char* method) {
diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc
index 25609a7759..3374bef095 100644
--- a/src/cpp/common/call.cc
+++ b/src/cpp/common/call.cc
@@ -233,13 +233,13 @@ void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) {
}
if (send_message_ || send_message_buffer_) {
if (send_message_) {
- GRPC_TIMER_MARK(SER_PROTO_BEGIN, 0);
+ GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_SERIALIZE, 0);
bool success = SerializeProto(*send_message_, &send_buf_);
if (!success) {
abort();
// TODO handle parse failure
}
- GRPC_TIMER_MARK(SER_PROTO_END, 0);
+ GRPC_TIMER_END(GRPC_PTAG_PROTO_SERIALIZE, 0);
} else {
send_buf_ = send_message_buffer_->buffer();
}
@@ -311,10 +311,10 @@ bool CallOpBuffer::FinalizeResult(void** tag, bool* status) {
if (recv_buf_) {
got_message = *status;
if (recv_message_) {
- GRPC_TIMER_MARK(DESER_PROTO_BEGIN, 0);
+ GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, 0);
*status = *status && DeserializeProto(recv_buf_, recv_message_, max_message_size_);
grpc_byte_buffer_destroy(recv_buf_);
- GRPC_TIMER_MARK(DESER_PROTO_END, 0);
+ GRPC_TIMER_END(GRPC_PTAG_PROTO_DESERIALIZE, 0);
} else {
recv_message_buffer_->set_buffer(recv_buf_);
}
diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc
index 07122db4a5..2b9000ea08 100644
--- a/src/cpp/common/completion_queue.cc
+++ b/src/cpp/common/completion_queue.cc
@@ -92,7 +92,7 @@ bool CompletionQueue::Pluck(CompletionQueueTag* tag) {
void CompletionQueue::TryPluck(CompletionQueueTag* tag) {
std::unique_ptr<grpc_event, EventDeleter> ev;
- ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_past));
+ ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_time_0));
if (!ev) return;
bool ok = ev->data.op_complete == GRPC_OP_OK;
void* ignored = tag;
diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc
index 8ab536aab8..b9554c4bb7 100644
--- a/src/cpp/proto/proto_utils.cc
+++ b/src/cpp/proto/proto_utils.cc
@@ -160,6 +160,7 @@ bool SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) {
bool DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
int max_message_size) {
+ if (!buffer) return false;
GrpcBufferReader reader(buffer);
::grpc::protobuf::io::CodedInputStream decoder(&reader);
if (max_message_size > 0) {
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index d8f8ab4b94..b7128da8c4 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -124,12 +124,12 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
std::unique_ptr<grpc::protobuf::Message> req;
std::unique_ptr<grpc::protobuf::Message> res;
if (has_request_payload_) {
- GRPC_TIMER_MARK(DESER_PROTO_BEGIN, call_.call());
+ GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, call_.call());
req.reset(method_->AllocateRequestProto());
if (!DeserializeProto(request_payload_, req.get(), call_.max_message_size())) {
abort(); // for now
}
- GRPC_TIMER_MARK(DESER_PROTO_END, call_.call());
+ GRPC_TIMER_END(GRPC_PTAG_PROTO_DESERIALIZE, call_.call());
}
if (has_response_payload_) {
res.reset(method_->AllocateResponseProto());
@@ -361,10 +361,10 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag {
bool orig_status = *status;
if (*status && request_) {
if (payload_) {
- GRPC_TIMER_MARK(DESER_PROTO_BEGIN, call_);
+ GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, call_);
*status = DeserializeProto(payload_, request_,
server_->max_message_size_);
- GRPC_TIMER_MARK(DESER_PROTO_END, call_);
+ GRPC_TIMER_END(GRPC_PTAG_PROTO_DESERIALIZE, call_);
} else {
*status = false;
}