aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-05-01 13:21:57 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-05-01 13:21:57 -0700
commitd6c16558b40b723d61039c2bfbf491f90adf3ecb (patch)
treeb30695b00ac0a6c7554d98f2b974e8f7bb8fbbc5 /src/cpp
parent9805bb2ce86413105e706da41a1b3e6040264e34 (diff)
parent5ae895a5d06fad59a89ce6e8923b1145dea663bd (diff)
Merge github.com:grpc/grpc into one-read
Conflicts: src/core/iomgr/tcp_posix.c src/core/profiling/basic_timers.c
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 9878133331..a60282316a 100644
--- a/src/cpp/common/call.cc
+++ b/src/cpp/common/call.cc
@@ -232,13 +232,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();
}
@@ -310,10 +310,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_);
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 b8de2ea173..c16d06fa37 100644
--- a/src/cpp/proto/proto_utils.cc
+++ b/src/cpp/proto/proto_utils.cc
@@ -159,6 +159,7 @@ bool SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) {
}
bool DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg) {
+ if (!buffer) return false;
GrpcBufferReader reader(buffer);
return msg->ParseFromZeroCopyStream(&reader);
}
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 4694a3a7ff..34aac4c584 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())) {
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());
@@ -346,9 +346,9 @@ 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_);
- GRPC_TIMER_MARK(DESER_PROTO_END, call_);
+ GRPC_TIMER_END(GRPC_PTAG_PROTO_DESERIALIZE, call_);
} else {
*status = false;
}